X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2Flibadacl.c;h=01cb4adaea9ebef67d9358b6ac1b5555dc452500;hb=450699ecf86f3bebab00ca162349270730026d7f;hp=d4e99aa2e48106ab51c806afc719f7890d2240c9;hpb=611d126f9917aa672bbcb1576946d4c99c24d84e;p=apply-default-acl.git diff --git a/src/libadacl.c b/src/libadacl.c index d4e99aa..01cb4ad 100644 --- a/src/libadacl.c +++ b/src/libadacl.c @@ -40,6 +40,9 @@ * open a file descriptor in a symlink-safe way when combined with * the @c O_NOFOLLOW flag. * + * The @c O_PATH flag is not used because we want to fail upon + * encountering any symlinks. + * * @param at_fd * A file descriptor relative to which @c pathname will be opened. * @@ -160,6 +163,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; }