X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Flib%2Fsyscall_setiattr-fscompat.hc;h=171e83c96767b4aeaae1585ef7b41e02093a87b6;hb=3265161cca571e9ce95e27215ff0f3e68b2377f9;hp=820db95d737839429415e498253bf1a788fbe81c;hpb=be0da3a8abaa934b3e7fc69dee8ab15157e4eab7;p=util-vserver.git diff --git a/util-vserver/lib/syscall_setiattr-fscompat.hc b/util-vserver/lib/syscall_setiattr-fscompat.hc index 820db95..171e83c 100644 --- a/util-vserver/lib/syscall_setiattr-fscompat.hc +++ b/util-vserver/lib/syscall_setiattr-fscompat.hc @@ -36,7 +36,7 @@ vc_set_iattr_fscompat(char const *filename, struct stat st; int stat_rc; - fd = open(filename, O_RDONLY); + fd = open(filename, O_RDONLY|O_NONBLOCK); if (fd==-1) return -1; stat_rc = fstat(fd, &st); @@ -51,11 +51,16 @@ vc_set_iattr_fscompat(char const *filename, } if ( (mask&VC_IATTR_BARRIER) ) { - mode_t m = ((flags&VC_IATTR_BARRIER) ? 0 : - st.st_mode ? st.st_mode : 0500); - - if (fchmod(fd, m)==-1) - goto err; + if ((flags&VC_IATTR_BARRIER)) { + if (vc_X_set_ext2flags(fd, VC_IMMUTABLE_LINK_FL, 0)==-1 || + fchmod(fd, 0)) + goto err; + } + else { + if (vc_X_set_ext2flags(fd, 0, VC_IMMUTABLE_LINK_FL)==-1 || + fchmod(fd, 0500)) + goto err; + } } if ( (mask&VC_IATTR_XID) &&