summaryrefslogtreecommitdiffstats
path: root/cpukit/libmisc/untar
diff options
context:
space:
mode:
authorRalf Corsepius <ralf.corsepius@rtems.org>2010-08-24 13:06:24 +0000
committerRalf Corsepius <ralf.corsepius@rtems.org>2010-08-24 13:06:24 +0000
commitb15fb6e065f9f61bf60320d35b1df8d10027f65c (patch)
tree343867947774d35c9171e656326781cf73a68f8d /cpukit/libmisc/untar
parent2010-09-24 Ralf Corsépius <ralf.corsepius@rtems.org> (diff)
downloadrtems-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/libmisc/untar')
-rw-r--r--cpukit/libmisc/untar/untar.c14
1 files changed, 8 insertions, 6 deletions
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 */