1) don't use getpwuid() to get username for uid 0, just use "root"
authorewt <devnull@localhost>
Tue, 22 Oct 1996 22:32:20 +0000 (22:32 +0000)
committerewt <devnull@localhost>
Tue, 22 Oct 1996 22:32:20 +0000 (22:32 +0000)
CVS patchset: 1131
CVS date: 1996/10/22 22:32:20

ftp.c

diff --git a/ftp.c b/ftp.c
index 52497ec..233c261 100644 (file)
--- a/ftp.c
+++ b/ftp.c
@@ -210,10 +210,14 @@ int ftpOpen(char * host, char * name, char * password, char * proxy,
        name = "anonymous";
 
     if (!password) {
-       pw = getpwuid(getuid());
-       password = alloca(strlen(pw->pw_name) + 2);
-       strcpy(password, pw->pw_name);
-       strcat(password, "@");
+       if (getuid()) {
+           pw = getpwuid(getuid());
+           password = alloca(strlen(pw->pw_name) + 2);
+           strcpy(password, pw->pw_name);
+           strcat(password, "@");
+       } else {
+           password = "root@";
+       }
     }
 
     if (proxy) {