svn commit: trunk/busybox/archival
landley at busybox.net
landley at busybox.net
Tue Jun 13 16:09:18 UTC 2006
Author: landley
Date: 2006-06-13 09:09:16 -0700 (Tue, 13 Jun 2006)
New Revision: 15370
Log:
Use xstat() instead of if(stat()) die()
Modified:
trunk/busybox/archival/bunzip2.c
trunk/busybox/archival/uncompress.c
trunk/busybox/archival/unlzma.c
Changeset:
Modified: trunk/busybox/archival/bunzip2.c
===================================================================
--- trunk/busybox/archival/bunzip2.c 2006-06-13 15:31:39 UTC (rev 15369)
+++ trunk/busybox/archival/bunzip2.c 2006-06-13 16:09:16 UTC (rev 15370)
@@ -50,10 +50,7 @@
if (strcmp(extension, ".bz2") != 0) {
bb_error_msg_and_die("Invalid extension");
}
- /* TODO: xstat */
- if (stat(filename, &stat_buf) < 0) {
- bb_error_msg_and_die("Couldn't stat file %s", filename);
- }
+ xstat(filename, &stat_buf);
*extension=0;
dst_fd = bb_xopen3(filename, O_WRONLY | O_CREAT, stat_buf.st_mode);
} else dst_fd = STDOUT_FILENO;
Modified: trunk/busybox/archival/uncompress.c
===================================================================
--- trunk/busybox/archival/uncompress.c 2006-06-13 15:31:39 UTC (rev 15369)
+++ trunk/busybox/archival/uncompress.c 2006-06-13 16:09:16 UTC (rev 15370)
@@ -61,12 +61,10 @@
*extension = '\0';
/* Open output file */
- dst_fd = bb_xopen(uncompressed_file, O_WRONLY | O_CREAT);
+ xstat(compressed_file, &stat_buf);
+ dst_fd = bb_xopen3(uncompressed_file, O_WRONLY | O_CREAT,
+ stat_buf.st_mode);
- /* Set permissions on the file */
- stat(compressed_file, &stat_buf);
- chmod(uncompressed_file, stat_buf.st_mode);
-
/* If unzip succeeds remove the old file */
delete_path = compressed_file;
}
Modified: trunk/busybox/archival/unlzma.c
===================================================================
--- trunk/busybox/archival/unlzma.c 2006-06-13 15:31:39 UTC (rev 15369)
+++ trunk/busybox/archival/unlzma.c 2006-06-13 16:09:16 UTC (rev 15370)
@@ -47,10 +47,7 @@
if (strcmp(extension, ".lzma") != 0) {
bb_error_msg_and_die("Invalid extension");
}
- /* TODO: xstat? */
- if (stat(filename, &stat_buf) < 0) {
- bb_error_msg_and_die("Couldn't stat file %s", filename);
- }
+ xstat(filename, &stat_buf);
*extension = 0;
dst_fd = bb_xopen3(filename, O_WRONLY | O_CREAT, stat_buf.st_mode);
} else
More information about the busybox-cvs
mailing list