diff options
| author | Ron Yorston <rmy@pobox.com> | 2021-08-12 13:27:46 +0100 |
|---|---|---|
| committer | Ron Yorston <rmy@pobox.com> | 2021-08-12 13:27:46 +0100 |
| commit | 9ec4642e35e2f5dc625f0e704020d41e8674fe99 (patch) | |
| tree | d3f6f942e66847d7538f4abef8a3ebbc2b980938 /libbb | |
| parent | da7efea0e7520f7ce8627acc9f4037a2f875c47e (diff) | |
| download | busybox-w32-9ec4642e35e2f5dc625f0e704020d41e8674fe99.tar.gz busybox-w32-9ec4642e35e2f5dc625f0e704020d41e8674fe99.tar.bz2 busybox-w32-9ec4642e35e2f5dc625f0e704020d41e8674fe99.zip | |
find_mount_point: code shrink
Use xrealloc_getcwd_or_warn() instead of a hand-rolled WIN32
equivalent.
Saves 84 bytes.
Diffstat (limited to 'libbb')
| -rw-r--r-- | libbb/find_mount_point.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/libbb/find_mount_point.c b/libbb/find_mount_point.c index c16f9e087..cf06c6e18 100644 --- a/libbb/find_mount_point.c +++ b/libbb/find_mount_point.c | |||
| @@ -32,7 +32,6 @@ struct mntent* FAST_FUNC find_mount_point(const char *name, int subdir_too) | |||
| 32 | static struct mntdata *data = NULL; | 32 | static struct mntdata *data = NULL; |
| 33 | char *current; | 33 | char *current; |
| 34 | const char *path; | 34 | const char *path; |
| 35 | DWORD len; | ||
| 36 | #endif | 35 | #endif |
| 37 | 36 | ||
| 38 | if (stat(name, &s) != 0) | 37 | if (stat(name, &s) != 0) |
| @@ -93,13 +92,8 @@ struct mntent* FAST_FUNC find_mount_point(const char *name, int subdir_too) | |||
| 93 | 92 | ||
| 94 | if ( isalpha(name[0]) && name[1] == ':' ) { | 93 | if ( isalpha(name[0]) && name[1] == ':' ) { |
| 95 | path = name; | 94 | path = name; |
| 96 | } | 95 | } else { |
| 97 | else { | 96 | path = current = xrealloc_getcwd_or_warn(NULL); |
| 98 | if ( (len=GetCurrentDirectory(0, NULL)) > 0 && | ||
| 99 | (current=malloc(len+1)) != NULL && | ||
| 100 | GetCurrentDirectory(len, current) ) { | ||
| 101 | path = current; | ||
| 102 | } | ||
| 103 | } | 97 | } |
| 104 | 98 | ||
| 105 | if ( path && isalpha(path[0]) && path[1] == ':' ) { | 99 | if ( path && isalpha(path[0]) && path[1] == ':' ) { |
