From a84f519214bf245052ad6be7b57fb68ac817cb7e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 29 Oct 2010 19:54:02 +0200 Subject: fsck: skip checking / if it is writable --- src/fsck.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/fsck.c b/src/fsck.c index bfa35f2e56..3c1652bc22 100644 --- a/src/fsck.c +++ b/src/fsck.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -170,6 +171,7 @@ int main(int argc, char *argv[]) { root_directory = false; } else { struct stat st; + struct timespec times[2]; /* Find root device */ @@ -182,6 +184,14 @@ int main(int argc, char *argv[]) { if (major(st.st_dev) == 0) return 0; + /* check if we are already writable */ + times[0] = st.st_atim; + times[1] = st.st_mtim; + if (utimensat(AT_FDCWD, "/", times, 0) == 0) { + log_error("Root directory is writable, skip check."); + goto finish; + } + if (!(udev = udev_new())) { log_error("Out of memory"); goto finish; -- cgit v1.2.3-54-g00ecf