aboutsummaryrefslogtreecommitdiffstats
path: root/src/c_lfiles.c
diff options
context:
space:
mode:
authorjozan <jozan@noemail.net>2020-11-15 18:25:10 +0000
committerjozan <jozan@noemail.net>2020-11-15 18:25:10 +0000
commit328a04717c4e3836070cb367850dd08d652c2399 (patch)
tree127e0122010b71acbc526741cd645a62ce08b1de /src/c_lfiles.c
parentA directory is now a required argument, for safety (diff)
parentno chdir, yeye (diff)
downloadunixize-328a04717c4e3836070cb367850dd08d652c2399.tar.gz
unixize-328a04717c4e3836070cb367850dd08d652c2399.tar.bz2
unixize-328a04717c4e3836070cb367850dd08d652c2399.tar.xz
unixize-328a04717c4e3836070cb367850dd08d652c2399.tar.zst
unixize-328a04717c4e3836070cb367850dd08d652c2399.zip
Merging branch 'no-chdir' into branch 'trunk'
FossilOrigin-Name: 00312a77c3bb7f0db518892200595d9dab614ad584ef1573311159eabc4bec2b
Diffstat (limited to 'src/c_lfiles.c')
-rw-r--r--src/c_lfiles.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/c_lfiles.c b/src/c_lfiles.c
index b420373..f22fed0 100644
--- a/src/c_lfiles.c
+++ b/src/c_lfiles.c
@@ -116,7 +116,7 @@ c_lfiles_new
}
struct lfiles_s*
-c_lfiles_gather(void)
+c_lfiles_gather(const char dir[])
{
DIR* dirp;
struct dirent* dp;
@@ -125,7 +125,7 @@ c_lfiles_gather(void)
head = NULL;
link = NULL;
- dirp = opendir(".");
+ dirp = opendir(dir);
if (dirp == NULL) {
u_dump_errno();
return (NULL);
@@ -134,12 +134,12 @@ c_lfiles_gather(void)
if (
strncmp(dp->d_name, ".", 2 * sizeof(char)) == 0 ||
strncmp(dp->d_name, "..", 3 * sizeof(char)) == 0
- ) {
+ ) {
continue;
}
link = c_lfiles_new(dp->d_name, dp->d_type);
if (link == NULL) {
- u_dump_errno();
+ u_dump_errno_path(dir);
c_lfiles_clear(&head);
return (NULL);
}