Patch from Denis Vlasenko: unlzma was make files with mode 777. Tweak

everything to do stat() and use xopen3().
This commit is contained in:
Rob Landley
2006-06-13 14:54:42 +00:00
parent 1dea55d577
commit 9a202c9daa
3 changed files with 15 additions and 8 deletions

View File

@@ -137,11 +137,8 @@ int gunzip_main(int argc, char **argv)
bb_error_msg_and_die("Invalid extension");
}
/* Open output file */
dst_fd = bb_xopen(new_path, O_WRONLY | O_CREAT);
/* Set permissions on the file */
chmod(new_path, stat_buf.st_mode);
/* Open output file (with correct permissions) */
dst_fd = bb_xopen3(new_path, O_WRONLY | O_CREAT, stat_buf.st_mode);
/* If unzip succeeds remove the old file */
delete_path = old_path;