summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2012-06-20 00:10:40 +0200
committerZdenek Kabelac <zkabelac@redhat.com>2012-08-23 14:37:20 +0200
commit6d0abc6b484f1441c6a0a65fd3c82bc09e9d2104 (patch)
treee91ee2bc68ce7f243cb4e58a506dd0f1bcdcc3db
parentb1640df5e6375926df0cc0e8dab217b21b23ce57 (diff)
downloadlvm2-6d0abc6b484f1441c6a0a65fd3c82bc09e9d2104.zip
lvm2-6d0abc6b484f1441c6a0a65fd3c82bc09e9d2104.tar.gz
lvm2-6d0abc6b484f1441c6a0a65fd3c82bc09e9d2104.tar.xz
cmirrord: check for result of chdir
Error exit if chdir fails.
-rw-r--r--daemons/cmirrord/clogd.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/daemons/cmirrord/clogd.c b/daemons/cmirrord/clogd.c
index 32b01a6..adf7a92 100644
--- a/daemons/cmirrord/clogd.c
+++ b/daemons/cmirrord/clogd.c
@@ -185,7 +185,11 @@ static void daemonize(void)
}
setsid();
- chdir("/");
+ if (chdir("/")) {
+ LOG_ERROR("Failed to chdir /: %s", strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+
umask(0);
if (close(0) || close(1) || close(2)) {