diff options
author | Ralf Corsepius <ralf.corsepius@rtems.org> | 2010-08-24 13:06:24 +0000 |
---|---|---|
committer | Ralf Corsepius <ralf.corsepius@rtems.org> | 2010-08-24 13:06:24 +0000 |
commit | b15fb6e065f9f61bf60320d35b1df8d10027f65c (patch) | |
tree | 343867947774d35c9171e656326781cf73a68f8d /cpukit | |
parent | 2010-09-24 Ralf Corsépius <ralf.corsepius@rtems.org> (diff) | |
download | rtems-b15fb6e065f9f61bf60320d35b1df8d10027f65c.tar.bz2 |
2010-08-24 Ralf Corsépius <ralf.corsepius@rtems.org>
* libmisc/untar/untar.c: Return if open fails.
Use ssize_t for read() return value.
Diffstat (limited to 'cpukit')
-rw-r--r-- | cpukit/ChangeLog | 6 | ||||
-rw-r--r-- | cpukit/libmisc/untar/untar.c | 14 |
2 files changed, 12 insertions, 8 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index 5c02350a51..2a9b77a898 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,11 +1,13 @@ -2010-09-24 Ralf Corsépius <ralf.corsepius@rtems.org> +2010-08-24 Ralf Corsépius <ralf.corsepius@rtems.org> + * libmisc/untar/untar.c: Return if open fails. + Use ssize_t for read() return value. * posix/src/aio_cancel.c: Spray pthread_mutex_unlocks. * posix/src/aio_read.c: aio_nbytes is always >= 0. * posix/src/aio_write.c: aio_nbytes is always >= 0. Fix typo in comment. -2010-09-24 Ralf Corsépius <ralf.corsepius@rtems.org> +2010-08-24 Ralf Corsépius <ralf.corsepius@rtems.org> * libcsupport/include/sys/utsname.h: Remove times(). Remove unnecessary includes. diff --git a/cpukit/libmisc/untar/untar.c b/cpukit/libmisc/untar/untar.c index b31eec9077..2c5c8e9cf3 100644 --- a/cpukit/libmisc/untar/untar.c +++ b/cpukit/libmisc/untar/untar.c @@ -254,7 +254,7 @@ Untar_FromFile( { int fd; char *bufr; - size_t n; + ssize_t n; char fname[100]; char linkname[100]; int sum; @@ -265,15 +265,17 @@ Untar_FromFile( unsigned long size; unsigned char linkflag; - retval = UNTAR_SUCCESSFUL; + + if ((fd = open(tar_name, O_RDONLY)) < 0) { + return UNTAR_FAIL; + } + bufr = (char *)malloc(512); - if (bufr == NULL) - { + if (bufr == NULL) { return(UNTAR_FAIL); } - - fd = open(tar_name, O_RDONLY); + while (1) { /* Read the header */ |