summaryrefslogtreecommitdiff
path: root/src/readahead-replay.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-03-03 23:03:26 +0100
committerLennart Poettering <lennart@poettering.net>2011-03-03 23:03:26 +0100
commit2b590e135f53a1bd3e771bdc555f7bf28c4cd232 (patch)
tree692dcb53426de099bc71ab5ed111d62823e74f2e /src/readahead-replay.c
parentc1b664d055276f47f152fe90d1dd765c384271bc (diff)
readahead: disable collector automatically on read-only media
Diffstat (limited to 'src/readahead-replay.c')
-rw-r--r--src/readahead-replay.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/readahead-replay.c b/src/readahead-replay.c
index cd89654f98..3bea9295fc 100644
--- a/src/readahead-replay.c
+++ b/src/readahead-replay.c
@@ -333,6 +333,7 @@ static int parse_argv(int argc, char *argv[]) {
int main(int argc, char*argv[]) {
int r;
+ const char *root;
log_set_target(LOG_TARGET_SYSLOG_OR_KMSG);
log_parse_environment();
@@ -341,6 +342,8 @@ int main(int argc, char*argv[]) {
if ((r = parse_argv(argc, argv)) <= 0)
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
+ root = optind < argc ? argv[optind] : "/";
+
if (!enough_ram()) {
log_info("Disabling readahead replay due to low memory.");
return 0;
@@ -357,7 +360,7 @@ int main(int argc, char*argv[]) {
shared->replay = getpid();
__sync_synchronize();
- if (replay(optind < argc ? argv[optind] : "/") < 0)
+ if (replay(root) < 0)
return 1;
return 0;