/* Some implementations of rmdir let you remove '.' or '/'. Report an error with errno set to zero for obvious cases of this; otherwise call rmdir. */ static int safer_rmdir (const char *file_name) { if (must_be_dot_or_slash (file_name)) { errno = 0; return -1; } return unlinkat (chdir_fd, file_name, AT_REMOVEDIR); }
/* Some implementations of rmdir let you remove '.' or '/'. Report an error with errno set to zero for obvious cases of this; otherwise call rmdir. */ static int safer_rmdir (const char *file_name) { if (must_be_dot_or_slash (file_name)) { errno = 0; return -1; } return rmdir (file_name); }