chiark / gitweb /
log_error() if inotify_add_watch() fails
authorHarald Hoyer <harald@redhat.com>
Wed, 13 Feb 2013 14:09:36 +0000 (15:09 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 13 Feb 2013 15:04:02 +0000 (10:04 -0500)
[zj: Reworded message s/to watch/to add watch on/ to make it clear
     that it was the watch init action that failed, and not the
     "process of watching". I think this way it'll be clearer to
     people who don't know what inotify does.]

src/login/sd-login.c
src/readahead/readahead-common.c
src/shared/ask-password-api.c
src/shared/util.c
src/tty-ask-password-agent/tty-ask-password-agent.c

index b81dddf86ba79d36259fd544476ca754ff3c2e8f..865527f8dda937f310656ccc37db69df294cae70 100644 (file)
@@ -733,6 +733,7 @@ _public_ int sd_login_monitor_new(const char *category, sd_login_monitor **m) {
         if (!category || streq(category, "seat")) {
                 k = inotify_add_watch(fd, "/run/systemd/seats/", IN_MOVED_TO|IN_DELETE);
                 if (k < 0) {
         if (!category || streq(category, "seat")) {
                 k = inotify_add_watch(fd, "/run/systemd/seats/", IN_MOVED_TO|IN_DELETE);
                 if (k < 0) {
+                        log_error("Failed to add watch on /run/systemd/seats/: %m");
                         close_nointr_nofail(fd);
                         return -errno;
                 }
                         close_nointr_nofail(fd);
                         return -errno;
                 }
@@ -743,6 +744,7 @@ _public_ int sd_login_monitor_new(const char *category, sd_login_monitor **m) {
         if (!category || streq(category, "session")) {
                 k = inotify_add_watch(fd, "/run/systemd/sessions/", IN_MOVED_TO|IN_DELETE);
                 if (k < 0) {
         if (!category || streq(category, "session")) {
                 k = inotify_add_watch(fd, "/run/systemd/sessions/", IN_MOVED_TO|IN_DELETE);
                 if (k < 0) {
+                        log_error("Failed to add watch on /run/systemd/sessions/: %m");
                         close_nointr_nofail(fd);
                         return -errno;
                 }
                         close_nointr_nofail(fd);
                         return -errno;
                 }
@@ -753,6 +755,7 @@ _public_ int sd_login_monitor_new(const char *category, sd_login_monitor **m) {
         if (!category || streq(category, "uid")) {
                 k = inotify_add_watch(fd, "/run/systemd/users/", IN_MOVED_TO|IN_DELETE);
                 if (k < 0) {
         if (!category || streq(category, "uid")) {
                 k = inotify_add_watch(fd, "/run/systemd/users/", IN_MOVED_TO|IN_DELETE);
                 if (k < 0) {
+                        log_error("Failed to add watch on /run/systemd/users/: %m");
                         close_nointr_nofail(fd);
                         return -errno;
                 }
                         close_nointr_nofail(fd);
                         return -errno;
                 }
index 41aaff0a3d1532caf323f936bb9577e3a21df24b..1599ac15a476b628bc27b86a0176a446bf84bd86 100644 (file)
@@ -227,7 +227,7 @@ int open_inotify(void) {
         mkdir("/run/systemd/readahead", 0755);
 
         if (inotify_add_watch(fd, "/run/systemd/readahead", IN_CREATE) < 0) {
         mkdir("/run/systemd/readahead", 0755);
 
         if (inotify_add_watch(fd, "/run/systemd/readahead", IN_CREATE) < 0) {
-                log_error("Failed to watch /run/systemd/readahead: %m");
+                log_error("Failed to add watch on /run/systemd/readahead: %m");
                 close_nointr_nofail(fd);
                 return -errno;
         }
                 close_nointr_nofail(fd);
                 return -errno;
         }
index 8a0fb89a84b8b69f61cb0a316e4c4d16ba7f56a4..10e6ae0614809ca9a6df9667b4944ce89f6be1c0 100644 (file)
@@ -78,6 +78,7 @@ int ask_password_tty(
                 }
 
                 if (inotify_add_watch(notify, flag_file, IN_ATTRIB /* for the link count */) < 0) {
                 }
 
                 if (inotify_add_watch(notify, flag_file, IN_ATTRIB /* for the link count */) < 0) {
+                        log_error("Failed to add watch on %s: %m", flag_file);
                         r = -errno;
                         goto finish;
                 }
                         r = -errno;
                         goto finish;
                 }
index d754c836f2b5386cd01f711fb71b74e030a4aa30..6ef191422c2dcc743a3e1e79ce898022983cf304 100644 (file)
@@ -2220,6 +2220,7 @@ int acquire_terminal(
                 wd = inotify_add_watch(notify, name, IN_CLOSE);
                 if (wd < 0) {
                         r = -errno;
                 wd = inotify_add_watch(notify, name, IN_CLOSE);
                 if (wd < 0) {
                         r = -errno;
+                        log_error("Failed to add watch on %s: %m", name);
                         goto fail;
                 }
         }
                         goto fail;
                 }
         }
index 99a626c6c58ad960ccf1e762e0b5426182b08f83..276ccf9780e3b7558a1282cf97f7acfae1cf83f8 100644 (file)
@@ -81,6 +81,7 @@ static int ask_password_plymouth(
                 }
 
                 if (inotify_add_watch(notify, flag_file, IN_ATTRIB /* for the link count */) < 0) {
                 }
 
                 if (inotify_add_watch(notify, flag_file, IN_ATTRIB /* for the link count */) < 0) {
+                        log_error("Failed to add watch on %s: %m", flag_file);
                         r = -errno;
                         goto finish;
                 }
                         r = -errno;
                         goto finish;
                 }
@@ -577,6 +578,7 @@ static int watch_passwords(void) {
         }
 
         if (inotify_add_watch(notify, "/run/systemd/ask-password", IN_CLOSE_WRITE|IN_MOVED_TO) < 0) {
         }
 
         if (inotify_add_watch(notify, "/run/systemd/ask-password", IN_CLOSE_WRITE|IN_MOVED_TO) < 0) {
+                log_error("Failed to add watch on /run/systemd/ask-password: %m");
                 r = -errno;
                 goto finish;
         }
                 r = -errno;
                 goto finish;
         }