From: Michael Orlitzky Date: Mon, 26 Feb 2018 22:36:24 +0000 (-0500) Subject: libadacl: add error checking when we open() the filesystem root. X-Git-Tag: v0.1.1~1 X-Git-Url: https://gitweb.michael.orlitzky.com/?p=apply-default-acl.git;a=commitdiff_plain;h=aaf323d45b5c2043acd64b7e6b8b1fea1664dd0b libadacl: add error checking when we open() the filesystem root. --- diff --git a/src/libadacl.c b/src/libadacl.c index d4e99aa..21b8141 100644 --- a/src/libadacl.c +++ b/src/libadacl.c @@ -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; }