diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2004-02-11 14:37:16 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2004-02-11 14:37:16 +0000 |
commit | 05f1fc465402f235a775e529a7f5b732632da554 (patch) | |
tree | 22e1fc2f6ce11965f022d401b4b4aa35ba5edb60 /firmware/common/dir.c | |
parent | b646d4f278017b4b3797ab0976239bd64df8b43e (diff) |
Empty file/dir names are now rejected by open() and mkdir()
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4303 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/common/dir.c')
-rw-r--r-- | firmware/common/dir.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/firmware/common/dir.c b/firmware/common/dir.c index e33bb7fc8f..c3965c2418 100644 --- a/firmware/common/dir.c +++ b/firmware/common/dir.c @@ -127,9 +127,9 @@ int mkdir(char *name, int mode) int rc; (void)mode; - + if ( name[0] != '/' ) { - DEBUGF("Only absolute paths supported right now\n"); + DEBUGF("mkdir: Only absolute paths supported right now\n"); return -1; } @@ -155,13 +155,19 @@ int mkdir(char *name, int mode) return -2; } + if(basename[0] == 0) { + DEBUGF("mkdir: Empty dir name\n"); + errno = EINVAL; + return -3; + } + /* Now check if the name already exists */ while ((entry = readdir(dir))) { if ( !strcasecmp(basename, entry->d_name) ) { DEBUGF("mkdir error: file exists\n"); errno = EEXIST; closedir(dir); - return - 3; + return - 4; } } |