* @param pathname
* The path to the file/directory/whatever whose descriptor you want.
*
+ * @param flags
+ * File status flags to be passed to @c openat.
+ *
* @return a file descriptor for @c pathname if everything goes well,
* and @c OPEN_ERROR if not.
*/
* @param pathname
* The path to the file/directory/whatever whose descriptor you want.
*
+ * @param flags
+ * File status flags to be passed to @c openat.
+ *
* @return a file descriptor for @c pathname if everything goes well,
* and @c OPEN_ERROR if not.
*/
}
int fd = open("/", flags);
+ if (fd == OPEN_ERROR) {
+ perror("safe_open (open)");
+ return OPEN_ERROR;
+ }
+
if (strcmp(abspath, "/") == 0) {
return fd;
}