/* No more slashes, this is the base case. */
return openat(at_fd, pathname, flags);
}
- else if (firstslash[1] == '\0') {
+ if (firstslash[1] == '\0') {
/* The first slash is the last character; ensure that we open
a directory. */
firstslash[0] = '\0';
* and @c OPEN_ERROR if not.
*/
int safe_open(const char* pathname, int flags) {
- if (pathname == NULL || strlen(pathname) == 0 || pathname[0] == '\0') {
+ if (pathname == NULL) {
errno = EINVAL;
perror("safe_open (args)");
return OPEN_ERROR;