|
Message-ID: <CAPLrYERWx+nMyuS6nQ1AoqfMtNioK2mCN4iF3mnB_Oo=MXSvGA@mail.gmail.com> Date: Fri, 16 Sep 2011 18:39:58 +0200 From: Daniel Cegiełka <daniel.cegielka@...il.com> To: owl-dev@...ts.openwall.com Subject: Re: cpio write(2) return value checks from: cpio-2.10.90-owl-fixes.diff diff -uNp -r cpio-2.10.90.old/src/copyin.c.orig cpio-2.10.90/src/copyin.c.orig --- cpio-2.10.90.old/src/copyin.c.orig 2011-09-15 06:03:13.645164165 +0000 +++ cpio-2.10.90/src/copyin.c.orig 2011-09-15 06:03:21.775176098 +0000 @@ -375,12 +375,12 @@ create_final_defers () continue; } out_file_des = open (d->header.c_name, - O_CREAT | O_WRONLY | O_BINARY, 0600); + O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0600); if (out_file_des < 0 && create_dir_flag) { create_all_directories (d->header.c_name); out_file_des = open (d->header.c_name, - O_CREAT | O_WRONLY | O_BINARY, + O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0600); } if (out_file_des < 0) @@ -483,13 +483,13 @@ copyin_regular_file (struct cpio_file_st /* If not linked, copy the contents of the file. */ out_file_des = open (file_hdr->c_name, - O_CREAT | O_WRONLY | O_BINARY, 0600); + O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0600); if (out_file_des < 0 && create_dir_flag) { create_all_directories (file_hdr->c_name); out_file_des = open (file_hdr->c_name, - O_CREAT | O_WRONLY | O_BINARY, + O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0600); } ======================================== and code from cpio-2.9-alt-open-O_EXCL.diff: Fix race conditions when creating regular files in copy-in and copy-pass modes * src/copyin.c (create_final_defers, copyin_regular_file): Change open(2) calls to use O_EXCL. * src/copypass.c (process_copy_pass): Likewise. --- cpio/src/copyin.c +++ cpio/src/copyin.c @@ -373,12 +373,12 @@ create_final_defers () continue; } out_file_des = open (d->header.c_name, - O_CREAT | O_WRONLY | O_BINARY, 0600); + O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0600); if (out_file_des < 0 && create_dir_flag) { create_all_directories (d->header.c_name); out_file_des = open (d->header.c_name, - O_CREAT | O_WRONLY | O_BINARY, + O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0600); } if (out_file_des < 0) @@ -481,13 +481,13 @@ copyin_regular_file (struct cpio_file_stat* file_hdr, int in_file_des) /* If not linked, copy the contents of the file. */ out_file_des = open (file_hdr->c_name, - O_CREAT | O_WRONLY | O_BINARY, 0600); + O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0600); if (out_file_des < 0 && create_dir_flag) { create_all_directories (file_hdr->c_name); out_file_des = open (file_hdr->c_name, - O_CREAT | O_WRONLY | O_BINARY, + O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0600); } --- end 2011/9/16 Vasiliy Kulikov <segoon@...nwall.com>: > Hi Daniel, > > On Fri, Sep 16, 2011 at 18:24 +0200, Daniel Cegiełka wrote: >> Can you check cpio-2.10.90-owl-fixes.diff? >> I think there is a conflict with cpio-2.9-alt-open-O_EXCL.diff. > > What do you mean? It applies without fuzz and with zero offset: > > (From a directory with all previous patches applied.) > $ patch -p1 < /home/vasya/owl-r/current/Owl/packages/cpio/cpio-2.10.90-owl-fixes.diff > patching file lib/rtapelib.c > patching file src/copyin.c > patching file src/copyin.c.orig > patching file src/copypass.c > patching file src/mt.c > patching file src/util.c > patching file tests/genfile.c > $ > > The same with the following patches. > > -- > Vasiliy >
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.