]> gitweb.michael.orlitzky.com - apply-default-acl.git/commitdiff
libadacl: add error checking when we open() the filesystem root.
authorMichael Orlitzky <michael@orlitzky.com>
Mon, 26 Feb 2018 22:36:24 +0000 (17:36 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Mon, 26 Feb 2018 22:36:24 +0000 (17:36 -0500)
src/libadacl.c

index d4e99aa2e48106ab51c806afc719f7890d2240c9..21b8141cbbc0158a3c6cfce3e985838bed1e20ce 100644 (file)
@@ -160,6 +160,11 @@ int safe_open(const char* pathname, int flags) {
   }
 
   int fd = open("/", flags);
+  if (fd == OPEN_ERROR) {
+    perror("safe_open (open)");
+    return OPEN_ERROR;
+  }
+
   if (strcmp(abspath, "/") == 0) {
     return fd;
   }