From 9ec4642e35e2f5dc625f0e704020d41e8674fe99 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Thu, 12 Aug 2021 13:27:46 +0100 Subject: find_mount_point: code shrink Use xrealloc_getcwd_or_warn() instead of a hand-rolled WIN32 equivalent. Saves 84 bytes. --- libbb/find_mount_point.c | 10 ++-------- 1 file 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) static struct mntdata *data = NULL; char *current; const char *path; - DWORD len; #endif if (stat(name, &s) != 0) @@ -93,13 +92,8 @@ struct mntent* FAST_FUNC find_mount_point(const char *name, int subdir_too) if ( isalpha(name[0]) && name[1] == ':' ) { path = name; - } - else { - if ( (len=GetCurrentDirectory(0, NULL)) > 0 && - (current=malloc(len+1)) != NULL && - GetCurrentDirectory(len, current) ) { - path = current; - } + } else { + path = current = xrealloc_getcwd_or_warn(NULL); } if ( path && isalpha(path[0]) && path[1] == ':' ) { -- cgit v1.2.3-55-g6feb