diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2012-04-27 15:03:34 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2012-04-27 15:03:34 +0200 |
commit | 0c62f20454b55a932d59c50b7418b8b634a8a23f (patch) | |
tree | f0855e58558970cd0130442d79f8baaa79340aeb /printutils | |
parent | deee356a629c81aae64ac22266561e9cc4e13e8b (diff) | |
download | busybox-0c62f20454b55a932d59c50b7418b8b634a8a23f.tar.gz |
lpr: small code shrink
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'printutils')
-rw-r--r-- | printutils/lpr.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/printutils/lpr.c b/printutils/lpr.c index fc6bca9e8..748879542 100644 --- a/printutils/lpr.c +++ b/printutils/lpr.c @@ -212,12 +212,9 @@ int lpqr_main(int argc UNUSED_PARAM, char *argv[]) ); // delete possible "\nX\n" patterns c = controlfile; - cflen = (unsigned)strlen(controlfile); while ((c = strchr(c, '\n')) != NULL) { if (c[1] && c[2] == '\n') { - /* can't use strcpy, results are undefined */ - memmove(c, c+2, cflen - (c-controlfile) - 1); - cflen -= 2; + overlapping_strcpy(c, c+2); } else { c++; } @@ -228,6 +225,7 @@ int lpqr_main(int argc UNUSED_PARAM, char *argv[]) bb_error_msg("sending control file"); /* "Acknowledgement processing must occur as usual * after the command is sent." */ + cflen = (unsigned)strlen(controlfile); fdprintf(fd, "\x2" "%u c%s\n", cflen, remote_filename); get_response_or_say_and_die(fd, "sending control file"); /* "Once all of the contents have |