summaryrefslogtreecommitdiffstats
path: root/cpukit/libmisc
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2010-10-11 04:40:08 +0000
committerChris Johns <chrisj@rtems.org>2010-10-11 04:40:08 +0000
commit5a24436e22a823a2fb929b6b0c9112a9011629bf (patch)
treecb8da493349021320a2b62934aebb09255f96bb3 /cpukit/libmisc
parentRegenerate. (diff)
downloadrtems-5a24436e22a823a2fb929b6b0c9112a9011629bf.tar.bz2
2010-10-11 Chris Johns <chrisj@rtems.org>
* libfs/src/rfs/rtems-rfs-trace.c, libfs/src/rfs/rtems-rfs-trace.h: Add inode-delete. * libfs/src/rfs/rtems-rfs-shell.c: Fix formatting. * libfs/src/rfs/rtems-rfs-rtems-dir.c: Use ssize_t. Fix spelling. * libfs/src/rfs/rtems-rfs-block.c: Fix rtems_rfs_block_get_bpos to return the position correctly. A bpos does not have any special processing. Do no reset the buffer handle when shrinking indirectly. * libfs/src/rfs/rtems-rfs-inode.c: Add trace. * libfs/src/rfs/rtems-rfs-format.c: Fix comments. * libfs/src/rfs/rtems-rfs-group.c: Limit the inodes to the blocks in a group so the accounting works. * libfs/src/rfs/rtems-rfs-dir.c: PR 1705. Fix handling the offsets when deleting an entry. * libfs/src/rfs/rtems-rfs-buffer.h: Remove rtems_rfs_buffer_handle_reset. It is not needed and dangerous. * cpukit/libmisc/untar/untar.c: Merge 4.11 pax fix. This fix also supports MacOS's tar.
Diffstat (limited to 'cpukit/libmisc')
-rw-r--r--cpukit/libmisc/untar/untar.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/cpukit/libmisc/untar/untar.c b/cpukit/libmisc/untar/untar.c
index 7f2c55d1fd..2c5c8e9cf3 100644
--- a/cpukit/libmisc/untar/untar.c
+++ b/cpukit/libmisc/untar/untar.c
@@ -39,7 +39,8 @@
* 148 8 bytes Header checksum (in octal ascii)
* 156 1 bytes Link flag
* 157 100 bytes Linkname ('\0' terminated, 99 maxmum length)
- * 257 8 bytes Magic ("ustar \0")
+ * 257 8 bytes Magic PAX ("ustar\0" + 2 bytes padding)
+ * 257 8 bytes Magic GNU tar ("ustar \0")
* 265 32 bytes User name ('\0' terminated, 31 maxmum length)
* 297 32 bytes Group name ('\0' terminated, 31 maxmum length)
* 329 8 bytes Major device ID (in octal ascii)
@@ -143,7 +144,7 @@ Untar_FromMemory(
/* Read the header */
bufr = &tar_ptr[ptr];
ptr += 512;
- if (strncmp(&bufr[257], "ustar ", 7))
+ if (strncmp(&bufr[257], "ustar", 5))
{
retval = UNTAR_SUCCESSFUL;
break;
@@ -253,7 +254,7 @@ Untar_FromFile(
{
int fd;
char *bufr;
- size_t n;
+ ssize_t n;
char fname[100];
char linkname[100];
int sum;
@@ -264,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 */
@@ -283,7 +286,7 @@ Untar_FromFile(
break;
}
- if (strncmp(&bufr[257], "ustar ", 7))
+ if (strncmp(&bufr[257], "ustar", 5))
{
break;
}