X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Fsrc%2Fchxid.c;h=f6bd807eeaf1aca721a989156f52f7cd0b761df1;hb=a64dcc3f8cc535c437f7b35cef4747576aca629d;hp=32d6683db78eb74cf4aa1b127fc4c9893735a58c;hpb=869ef86707f88fe8924fdc30c434a21e128390d9;p=util-vserver.git diff --git a/util-vserver/src/chxid.c b/util-vserver/src/chxid.c index 32d6683..f6bd807 100644 --- a/util-vserver/src/chxid.c +++ b/util-vserver/src/chxid.c @@ -66,46 +66,17 @@ showVersion() exit(0); } -static bool -setFile(char const *name, char const * display_name, struct stat const *exp_st) +bool +handleFile(char const *name, char const * display_name) { - bool res = false; - int fd = open(name, O_RDONLY); - int rc; - - if (fd==-1) { - perror("open()"); - return false; - } - - // this is still needed... the file must be open so that vc_set_iattr() - // operates on a known file/inode - if (!exp_st || - !checkForRace(fd, name, exp_st)) - goto err; - - rc = vc_set_iattr_compat(name, exp_st->st_dev, exp_st->st_ino, - global_args->ctx, 0, VC_IATTR_XID); + int rc = vc_set_iattr(name, global_args->ctx, 0, VC_IATTR_XID); if (rc==-1) { perror(display_name); - goto err; + return false; } - res = true; - - err: - close(fd); - return res; -} - -bool -handleFile(char const *name, char const * display_name, - struct stat const *exp_st) -{ - if (!S_ISREG(exp_st->st_mode)) return true; - - return setFile(name, display_name, exp_st); + return true; } void @@ -122,5 +93,6 @@ fixupParams(struct Arguments UNUSED *args, int argc) } args->ctx = resolveCtx(args->ctx_str); - args->do_display_dir = false; + args->do_display_dir = !args->do_recurse; + args->do_display_dot = true; }