From a195f436b72f95926f693584ccdddf7ecf726213 Mon Sep 17 00:00:00 2001 From: Rafal Wojtczuk Date: Wed, 16 Mar 2011 12:48:29 +0100 Subject: [PATCH] In qfile-unpacker, set perms on the directory only on second pass. It solves problem with transferring r.x directory. Originally, it would fail when creating files in the directory (as it is not writable). Now, we will create it rwx, create files in it, and fix perms and utimes on the second pass. [user@devel fcopy]$ ls -ald /boot dr-xr-xr-x 4 root root 4096 Sep 1 2010 /boot --- appvm/unpack.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/appvm/unpack.c b/appvm/unpack.c index c0353c11..ad53ebf5 100644 --- a/appvm/unpack.c +++ b/appvm/unpack.c @@ -53,7 +53,11 @@ void process_one_file_reg(struct file_header *hdr, char *name) void process_one_file_dir(struct file_header *hdr, char *name) { - if (mkdir(name, 0700) && errno != EEXIST) +// fix perms only when the directory is sent for the second time +// it allows to transfer r.x directory contents, as we create it rwx initially + if (!mkdir(name, 0700)) + return; + if (errno != EEXIST) do_exit(errno); fix_times_and_perms(hdr, name); }