summaryrefslogtreecommitdiff
path: root/src/readahead-collect.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/readahead-collect.c')
-rw-r--r--src/readahead-collect.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/readahead-collect.c b/src/readahead-collect.c
index 330d10776f..0970b58419 100644
--- a/src/readahead-collect.c
+++ b/src/readahead-collect.c
@@ -639,6 +639,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();
@@ -647,6 +648,13 @@ 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 (fs_on_read_only(root) > 0) {
+ log_info("Disabling readahead collector due to read-only media.");
+ return 0;
+ }
+
if (!enough_ram()) {
log_info("Disabling readahead collector due to low memory.");
return 0;
@@ -663,7 +671,7 @@ int main(int argc, char *argv[]) {
shared->collect = getpid();
__sync_synchronize();
- if (collect(optind < argc ? argv[optind] : "/") < 0)
+ if (collect(root) < 0)
return 1;
return 0;