+ int fd = 0;
+ if (strcmp(abspath, "/") == 0) {
+ fd = open("/", flags | O_DIRECTORY);
+ }
+ else {
+ /* Use O_PATH for some added safety if "/" is not our target */
+ fd = open("/", flags | O_DIRECTORY | O_PATH);
+ }
+ if (fd == OPEN_ERROR) {
+ perror("safe_open (open)");
+ return OPEN_ERROR;
+ }
+