[Pvfs2-cvs] commit by dbonnie in pvfs2/src/apps/admin: pvfs2-cp.c
CVS commit program
cvs at parl.clemson.edu
Wed Sep 3 11:45:48 EDT 2008
Update of /anoncvs/pvfs2/src/apps/admin
In directory parlweb1:/tmp/cvs-serv26172/src/apps/admin
Modified Files:
Tag: cu-security-branch
pvfs2-cp.c
Log Message:
Update pvfs2-cp to work properly when the pvfs2 filesystem is not mounted.
Index: pvfs2-cp.c
===================================================================
RCS file: /anoncvs/pvfs2/src/apps/admin/pvfs2-cp.c,v
diff -p -u -r1.26.2.3 -r1.26.2.4
--- pvfs2-cp.c 22 Jul 2008 19:26:15 -0000 1.26.2.3
+++ pvfs2-cp.c 3 Sep 2008 15:45:48 -0000 1.26.2.4
@@ -155,6 +155,11 @@ int main (int argc, char ** argv)
fprintf(stderr, "Could not open %s\n", user_opts->srcfile);
goto main_out;
}
+ else
+ {
+ /* copy permissions in case the PVFS2 filesystem is not mounted */
+ dest.u.pvfs2.attr.perms = src.u.pvfs2.perms;
+ }
ret = generic_open(&dest, credential, user_opts->num_datafiles, user_opts->strip_size,
user_opts->srcfile, OPEN_DEST);
@@ -614,9 +619,23 @@ static int generic_open(file_object *obj
memset(&stat_buf, 0, sizeof(struct stat));
/* preserve permissions doing a unix => pvfs2 copy */
- stat(srcname, &stat_buf);
- make_attribs(&(obj->u.pvfs2.attr), credential, nr_datafiles,
+ int test = stat(srcname, &stat_buf);
+ if (test == -1)
+ {
+ /* PVFS2 filesystem is not mounted. The source permissions
+ * were copied into the destination above in main to account
+ * for this. Manually copying remaining attributes */
+ obj->u.pvfs2.attr.owner = credential->userid;
+ obj->u.pvfs2.attr.group = credential->group_array[0];
+ obj->u.pvfs2.attr.mask = (PVFS_ATTR_SYS_ALL_SETABLE);
+ obj->u.pvfs2.attr.dfile_count = nr_datafiles;
+ }
+ else
+ {
+ /* stat completed sucessfully */
+ make_attribs(&(obj->u.pvfs2.attr), credential, nr_datafiles,
(int)stat_buf.st_mode);
+ }
if (strip_size > 0) {
new_dist = PVFS_sys_dist_lookup("simple_stripe");
ret = PVFS_sys_dist_setparam(new_dist, "strip_size", &strip_size);
More information about the Pvfs2-cvs
mailing list