tweaks: condense two comments, and rewrap a line

master
Benno Schulenberg 2019-10-09 14:36:28 +02:00
parent 600f81cf98
commit 557ad827f9
1 changed files with 3 additions and 6 deletions

View File

@ -1326,9 +1326,8 @@ char *get_full_path(const char *origpath)
return target; return target;
} }
/* Return the full version of path, as returned by get_full_path(). On /* Check whether the given path refers to a directory that is writable.
* error, or if path doesn't reference a directory, or if the directory * Return the absolute form of the path on success, and NULL on failure. */
* isn't writable, return NULL. */
char *check_writable_directory(const char *path) char *check_writable_directory(const char *path)
{ {
char *full_path = get_full_path(path); char *full_path = get_full_path(path);
@ -1336,9 +1335,7 @@ char *check_writable_directory(const char *path)
if (full_path == NULL) if (full_path == NULL)
return NULL; return NULL;
/* If we can't write to path or path isn't a directory, return NULL. */ if (full_path[strlen(full_path) - 1] != '/' || access(full_path, W_OK) != 0) {
if (access(full_path, W_OK) != 0 ||
full_path[strlen(full_path) - 1] != '/') {
free(full_path); free(full_path);
return NULL; return NULL;
} }