From 81b0b397f59e5f06067add712ba9905db6209b8f Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Tue, 14 Jan 2020 13:57:27 -0500 Subject: Handle realpath() error when string is NULL --- src/fs.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/fs.c b/src/fs.c index 1ee7901..e3f4d1f 100644 --- a/src/fs.c +++ b/src/fs.c @@ -13,6 +13,11 @@ FSTree *fstree(const char *_path) { FTSENT *node = NULL; FSTree *fsdata = NULL; char *path = realpath(_path, NULL); + if (path == NULL) { + perror(_path); + fprintf(SYSERROR); + return NULL; + } char *root[2] = { path, NULL }; size_t dirs_size = 2; -- cgit