diff options
author | Glenn L McGrath <bug1@ihug.co.nz> | 2003-06-10 17:22:49 +0000 |
---|---|---|
committer | Glenn L McGrath <bug1@ihug.co.nz> | 2003-06-10 17:22:49 +0000 |
commit | 24833430bc2dbea733c3b0b9ea6c6b976f95474a (patch) | |
tree | 805a4197b8a0d36eaa6880dfc23d8c2539359fe9 /libbb | |
parent | 6c43f743a3f607f91ee22a53db880fce2df645f0 (diff) | |
download | busybox-24833430bc2dbea733c3b0b9ea6c6b976f95474a.tar.gz |
Vodz, last_patch_88
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/find_root_device.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/libbb/find_root_device.c b/libbb/find_root_device.c index b12d392a2..654f17145 100644 --- a/libbb/find_root_device.c +++ b/libbb/find_root_device.c @@ -48,11 +48,14 @@ extern char *find_real_root_device_name(const char* name) bb_perror_msg("could not open '/dev'"); else { while((entry = readdir(dir)) != NULL) { - - fileName = concat_subpath_file("/dev", entry->d_name); - if(fileName == NULL) + const char *name = entry->d_name; + /* Must skip ".." since that is "/", and so we + * would get a false positive on ".." */ + if (name[0] == '.' && name[1] == '.' && !name[2]) continue; + fileName = concat_path_file("/dev", name); + /* Some char devices have the same dev_t as block * devices, so make sure this is a block device */ if (stat(fileName, &statBuf) == 0 && @@ -66,7 +69,7 @@ extern char *find_real_root_device_name(const char* name) } } if(fileName==NULL) - fileName=bb_xstrdup("/dev/root"); + fileName = bb_xstrdup("/dev/root"); return fileName; } |