Skip to content

Commit

Permalink
Don't fail on NULL 'prefix' pointers.
Browse files Browse the repository at this point in the history
  • Loading branch information
brianwalenz committed Nov 19, 2019
1 parent ed32e61 commit e69e34c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/utility/files.C
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,9 @@ AS_UTL_makeReadOnly(const char *prefix, char separator, const char *suffix) {
char path[FILENAME_MAX];
struct stat s;

if (prefix == NULL)
return(false);

if (suffix)
snprintf(path, FILENAME_MAX, "%s%c%s", prefix, separator, suffix);
else
Expand Down Expand Up @@ -387,6 +390,9 @@ AS_UTL_makeWritable(const char *prefix, char separator, const char *suffix) {
char path[FILENAME_MAX];
struct stat s;

if (prefix == NULL)
return(false);

if (suffix)
snprintf(path, FILENAME_MAX, "%s%c%s", prefix, separator, suffix);
else
Expand Down Expand Up @@ -417,6 +423,9 @@ pathExists(const char *prefix, char separator, const char *suffix) {
struct stat s;
char path[FILENAME_MAX];

if (prefix == NULL)
return(false);

if (suffix)
snprintf(path, FILENAME_MAX, "%s%c%s", prefix, separator, suffix);
else
Expand All @@ -436,6 +445,9 @@ fileExists(const char *prefix, char separator, const char *suffix,
struct stat s;
char path[FILENAME_MAX];

if (prefix == NULL)
return(false);

if (suffix)
snprintf(path, FILENAME_MAX, "%s%c%s", prefix, separator, suffix);
else
Expand Down Expand Up @@ -463,6 +475,9 @@ directoryExists(const char *prefix, char separator, const char *suffix) {
struct stat s;
char path[FILENAME_MAX];

if (prefix == NULL)
return(false);

if (suffix)
snprintf(path, FILENAME_MAX, "%s%c%s", prefix, separator, suffix);
else
Expand Down

0 comments on commit e69e34c

Please sign in to comment.