From: Rob Landley Date: Fri, 12 Aug 2005 06:06:54 +0000 (-0000) Subject: Backport 10853, 10860/10870, and 10862. X-Git-Tag: 1_01~14 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=d5138f44fe2e496498c62a06b7f50381edf952da;p=oweals%2Fbusybox.git Backport 10853, 10860/10870, and 10862. --- diff --git a/busybox/libbb/copy_file.c b/busybox/libbb/copy_file.c index 68a1ded04..4b349b7fc 100644 --- a/busybox/libbb/copy_file.c +++ b/busybox/libbb/copy_file.c @@ -197,12 +197,16 @@ int copy_file(const char *source, const char *dest, int flags) S_ISSOCK(source_stat.st_mode) || S_ISFIFO(source_stat.st_mode) || S_ISLNK(source_stat.st_mode)) { - if (dest_exists && - ((flags & FILEUTILS_FORCE) == 0 || unlink(dest) < 0)) { + if (dest_exists) { + if((flags & FILEUTILS_FORCE) == 0) { + fprintf(stderr, "`%s' exists\n", dest); + return -1; + } + if(unlink(dest) < 0) { bb_perror_msg("unable to remove `%s'", dest); return -1; - } + } } else { bb_error_msg("internal error: unrecognized file type"); return -1; diff --git a/busybox/networking/nc.c b/busybox/networking/nc.c index ab8ec0cd5..6ce85fecf 100644 --- a/busybox/networking/nc.c +++ b/busybox/networking/nc.c @@ -161,8 +161,11 @@ int nc_main(int argc, char **argv) exit(0); ofd = STDOUT_FILENO; } else { - if (nread == 0) - shutdown(sfd, 1); + if (nread <= 0) { + shutdown(sfd, 1 /* send */ ); + close(STDIN_FILENO); + FD_CLR(STDIN_FILENO, &readfds); + } ofd = sfd; } diff --git a/busybox/networking/traceroute.c b/busybox/networking/traceroute.c index 44ffdf07e..cf90ec088 100644 --- a/busybox/networking/traceroute.c +++ b/busybox/networking/traceroute.c @@ -101,7 +101,8 @@ struct opacket { #include "busybox.h" -static u_char packet[512]; /* last inbound (icmp) packet */ + /* last inbound (icmp) packet */ +static u_char packet[512] __attribute__ ((aligned)); static struct opacket *outpacket; /* last output (udp) packet */ static int s; /* receive (icmp) socket file descriptor */