chiark / gitweb /
swap: ignore missing /proc/swaps
authorMichael Olbrich <m.olbrich@pengutronix.de>
Fri, 24 Jun 2011 11:43:19 +0000 (13:43 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 27 Jun 2011 12:32:44 +0000 (14:32 +0200)
Otherwise systemd reports "Failed to fully start up daemon: No such file or
directory" when swap is disabled in the kernel.

src/swap.c

index 14719ad..7675e6a 100644 (file)
@@ -1237,7 +1237,7 @@ static int swap_enumerate(Manager *m) {
 
         if (!m->proc_swaps) {
                 if (!(m->proc_swaps = fopen("/proc/swaps", "re")))
-                        return -errno;
+                        return (errno == ENOENT) ? 0 : -errno;
 
                 m->swap_watch.type = WATCH_SWAP;
                 m->swap_watch.fd = fileno(m->proc_swaps);