aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormaximilian attems <max@stro.at>2007-08-25 01:05:34 +0200
committermaximilian attems <max@stro.at>2007-08-25 01:23:40 +0200
commit599d5ba480ec63bdd32d6d55a572e7a0ac6e08d4 (patch)
tree82fc07ab2f03b72e957317dc383f61380167dad4
parent7db15307925a4f502b4e77b6942d144cb82092a1 (diff)
downloadklibc-599d5ba480ec63bdd32d6d55a572e7a0ac6e08d4.tar.gz
[klibc] cpio: preprocessor cleanupsklibc-1.5.6
* kill useless macro FILE_SYSTEM_PREFIX_LEN * use symlink() directly * a compiler which doesn't support long long needs to be shot kick __GNUC__ protection around * remove compat defines against old stat.h Signed-off-by: maximilian attems <max@stro.at>
-rw-r--r--usr/utils/cpio.c34
1 files changed, 6 insertions, 28 deletions
diff --git a/usr/utils/cpio.c b/usr/utils/cpio.c
index db626a39a002e..8acfe6f11979f 100644
--- a/usr/utils/cpio.c
+++ b/usr/utils/cpio.c
@@ -43,16 +43,6 @@
# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR)
# endif
-# ifndef FILE_SYSTEM_PREFIX_LEN
-# define FILE_SYSTEM_PREFIX_LEN(Filename) 0
-# endif
-
-#ifndef SYMLINK_USES_UMASK
-# define UMASKED_SYMLINK(name1,name2,mode) symlink(name1,name2)
-#else
-# define UMASKED_SYMLINK(name1,name2,mode) umasked_symlink(name1,name2,mode)
-#endif /* SYMLINK_USES_UMASK */
-
/* Return 1 if an array of N objects, each of size S, cannot exist due
to size arithmetic overflow. S must be positive and N must be
nonnegative. This is a macro, not an inline function, so that it
@@ -110,16 +100,10 @@ struct new_cpio_header {
};
/* Total number of bytes read and written for all files.
- Now that many tape drives hold more than 4Gb we need more than 32
- bits to hold input_bytes and output_bytes. But it's not worth
- the trouble of adding special multi-precision arithmetic if the
- compiler doesn't support 64 bit ints since input_bytes and
- output_bytes are only used to print the number of blocks copied. */
-#ifdef __GNUC__
+ * Now that many tape drives hold more than 4Gb we need more than 32
+ * bits to hold input_bytes and output_bytes.
+ */
long long input_bytes, output_bytes;
-#else
-long input_bytes, output_bytes;
-#endif
/* Allocate N bytes of memory dynamically, with error checking. */
@@ -709,7 +693,7 @@ copyin_regular_file(struct new_cpio_header *file_hdr, int in_file_des)
static char *base_name(char const *name)
{
- char const *base = name + FILE_SYSTEM_PREFIX_LEN(name);
+ char const *base = name;
char const *p;
for (p = base; *p; p++) {
@@ -856,9 +840,9 @@ static void copyin_link(struct new_cpio_header *file_hdr, int in_file_des)
tape_buffered_read(link_name, in_file_des, file_hdr->c_filesize);
tape_skip_padding(in_file_des, file_hdr->c_filesize);
- res = UMASKED_SYMLINK(link_name, file_hdr->c_name, file_hdr->c_mode);
+ res = symlink(link_name, file_hdr->c_name);
if (res < 0) {
- fprintf(stderr, "%s: UMASKED_SYMLINK %s: %s\n",
+ fprintf(stderr, "%s: symlink %s: %s\n",
progname, file_hdr->c_name, strerror(errno));
free(link_name);
return;
@@ -890,20 +874,14 @@ static void copyin_file(struct new_cpio_header *file_hdr, int in_file_des)
case S_IFCHR:
case S_IFBLK:
-#ifdef S_IFSOCK
case S_IFSOCK:
-#endif
-#ifdef S_IFIFO
case S_IFIFO:
-#endif
copyin_device(file_hdr);
break;
-#ifdef S_IFLNK
case S_IFLNK:
copyin_link(file_hdr, in_file_des);
break;
-#endif
default:
fprintf(stderr, "%s: %s: unknown file type\n",