wget: fix error message.
authorDenis Vlasenko <vda.linux@googlemail.com>
Fri, 10 Nov 2006 23:25:53 +0000 (23:25 -0000)
committerDenis Vlasenko <vda.linux@googlemail.com>
Fri, 10 Nov 2006 23:25:53 +0000 (23:25 -0000)
Bad:
wget http://127.0.0.1:81/fgdg/Makefile
Connecting to 127.0.0.1[127.0.0.1]:81
: HTTP/1.0 404 Not Foundror 404 Not Found
Good:
wget http://127.0.0.1:81/fgdg/Makefile
Connecting to 127.0.0.1[127.0.0.1]:81
get: server returned error: HTTP/1.0 404 Not Found

nslookup: fix my mistake
applets: make Bernhard Fischer <rep.nop@aon.at> happy :)

applets/applets.c
libbb/chomp.c
networking/nslookup.c
networking/wget.c

index d8bb133033e3e959e650bf1c640762f5ab287b1a..23f9e4f924d98ee652a396613cc716e991ef6eb3 100644 (file)
@@ -20,7 +20,7 @@
 /* Apparently uclibc defines __GLIBC__ (compat trick?). Oh well. */
 #if ENABLE_STATIC && defined(__GLIBC__) && !defined(__UCLIBC__)
 #warning Static linking against glibc produces buggy executables
-#warning (glibc doesn't cope well with ld --gc-sections).
+#warning (glibc does not cope well with ld --gc-sections).
 #warning See sources.redhat.com/bugzilla/show_bug.cgi?id=3400
 #warning Note that glibc is utterly unsuitable for static linking anyway.
 #endif
index 6165b83bca649d1ab80a9a188ed6b0764d32a04a..eab7707600062ebeced31b9c7532cb7c76b04edd 100644 (file)
@@ -8,15 +8,12 @@
  * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
  */
 
-#include <stdio.h>
-#include <string.h>
 #include "libbb.h"
 
-
 void chomp(char *s)
 {
        char *lc = last_char_is(s, '\n');
 
-       if(lc)
+       if (lc)
                *lc = 0;
 }
index 89a2d6481e45d7c5f78fe55f97b4e55b65b0d5d2..cc5ff95d69cf1044e544047da5c7433d6c93a749 100644 (file)
@@ -82,7 +82,7 @@ static int print_host(const char *hostname, const char *header)
                while (cur) {
                        sockaddr_to_dotted(cur->ai_addr, str, sizeof(str));
                        printf("%s  %s\nAddress: %s", header, hostname, str);
-                       s[0] = ' ';
+                       str[0] = ' ';
                        if (getnameinfo(cur->ai_addr, cur->ai_addrlen, str+1, sizeof(str)-1, NULL, 0, NI_NAMEREQD))
                                str[0] = '\0';
                        puts(str);
index 8850fdfb7168f5bc2f8ab28a2cfc85d0467f4cde..a4c6289cb493ed16abe0de65aad52236a3ab056f 100644 (file)
@@ -324,8 +324,9 @@ int wget_main(int argc, char **argv)
                                        break;
                                /*FALLTHRU*/
                        default:
-                               chomp(buf);
-                               bb_error_msg_and_die("server returned error %s: %s", s, buf);
+                               /* Show first line only and kill any ESC tricks */
+                               buf[strcspn(buf, "\n\r\x1b")] = '\0';
+                               bb_error_msg_and_die("server returned error: %s", buf);
                        }
 
                        /*
@@ -585,6 +586,8 @@ static FILE *open_socket(struct sockaddr_in *s_in)
 {
        FILE *fp;
 
+       /* glibc 2.4 seems to try seeking on it - ??! */
+       /* hopefully it understands what ESPIPE means... */
        fp = fdopen(xconnect_tcp_v4(s_in), "r+");
        if (fp == NULL)
                bb_perror_msg_and_die("fdopen");