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 +2010-08-24 Ralf Corsépius + * 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 +2010-08-24 Ralf Corsépius * 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; - bufr = (char *)malloc(512); - if (bufr == NULL) - { - return(UNTAR_FAIL); + + if ((fd = open(tar_name, O_RDONLY)) < 0) { + return UNTAR_FAIL; } - fd = open(tar_name, O_RDONLY); + bufr = (char *)malloc(512); + if (bufr == NULL) { + return(UNTAR_FAIL); + } + while (1) { /* Read the header */