aboutsummaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2024-07-07 12:51:51 +0100
committerRon Yorston <rmy@pobox.com>2024-07-07 13:04:40 +0100
commita694cb601a92a1e4eded89f4c13793c9d12e33b6 (patch)
treef7cda76d1343e5c966b7ad80d3ab53441322b6e5 /networking
parentf4fc4fb51fcba40a5db81861629fff27d73bed85 (diff)
downloadbusybox-w32-a694cb601a92a1e4eded89f4c13793c9d12e33b6.tar.gz
busybox-w32-a694cb601a92a1e4eded89f4c13793c9d12e33b6.tar.bz2
busybox-w32-a694cb601a92a1e4eded89f4c13793c9d12e33b6.zip
win32: code shrink system drive handling
A previous commit (e3bfe3695) revised the use of getsysdir() to obtain the system directory, and hence the system drive. See the commit message for the history to that point. Further improvements are possible: - Remove getsysdir() and push the calls to GetSystemDirectory() down into get_system_drive() and get_proc_addr(). - Check the return value of GetSystemDirectory(). It's unlikely to fail, but better safe than sorry. - Instead of making all callers of get_system_drive() check for a NULL return value always return a non-NULL pointer. If the drive can't be found an empty string is returned instead (which is what the callers were using anyway). - The function need_system_drive() was only used in one place (in httpd). Move the code there and remove the function. - Use concat_path_file() where possible. Saves 76-144 bytes.
Diffstat (limited to 'networking')
-rw-r--r--networking/httpd.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/networking/httpd.c b/networking/httpd.c
index bd3a5a097..1dae602ee 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -754,10 +754,11 @@ static int parse_conf(const char *path, int flag)
754 filename = alloca(strlen(path) + sizeof(HTTPD_CONF) + 2); 754 filename = alloca(strlen(path) + sizeof(HTTPD_CONF) + 2);
755 sprintf((char *)filename, "%s/%s", path, HTTPD_CONF); 755 sprintf((char *)filename, "%s/%s", path, HTTPD_CONF);
756#else 756#else
757 const char *sd = need_system_drive(path); 757 const char *sd = "";
758 if (root_len(path) == 0 && (path[0] == '/' || path[0] == '\\'))
759 sd = get_system_drive();
758 760
759 filename = auto_string(xasprintf("%s%s/%s", sd ? sd : "", 761 filename = auto_string(xasprintf("%s%s/%s", sd, path, HTTPD_CONF));
760 path, HTTPD_CONF));
761#endif 762#endif
762 } 763 }
763 764