summaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorDenis Vlasenko2007-08-06 12:28:24 +0000
committerDenis Vlasenko2007-08-06 12:28:24 +0000
commit8e209c3787f3b7d7bda3915afc6df0604b60707c (patch)
tree5704e9f6b237952d7793571b151899aceec32f84 /coreutils
parent73f21e9cb3aaa6f1643d2edc4f6abceda9a17834 (diff)
downloadbusybox-8e209c3787f3b7d7bda3915afc6df0604b60707c.zip
busybox-8e209c3787f3b7d7bda3915afc6df0604b60707c.tar.gz
catv: catv without arguments was trying to use environ as argv.
(Alex Landau <landau_alex@yahoo.com>)
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/catv.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/coreutils/catv.c b/coreutils/catv.c
index 876b67a..0ca73a0 100644
--- a/coreutils/catv.c
+++ b/coreutils/catv.c
@@ -15,7 +15,8 @@
int catv_main(int argc, char **argv);
int catv_main(int argc, char **argv)
{
- int retval = EXIT_SUCCESS, fd;
+ int retval = EXIT_SUCCESS;
+ int fd;
unsigned flags;
flags = getopt32(argc, argv, "etv");
@@ -27,8 +28,10 @@ int catv_main(int argc, char **argv)
/* Read from stdin if there's nothing else to do. */
fd = 0;
- if (!argv[0])
+ if (!argv[0]) {
+ argv--;
goto jump_in;
+ }
do {
fd = open_or_warn(*argv, O_RDONLY);
if (fd < 0) {
@@ -46,7 +49,7 @@ int catv_main(int argc, char **argv)
if (res < 1)
break;
for (i = 0; i < res; i++) {
- char c = read_buf[i];
+ unsigned char c = read_buf[i];
if (c > 126 && (flags & CATV_OPT_v)) {
if (c == 127) {