[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 19/20: fakeroot: Fix reopening files after a chmod
From: |
Samuel Thibault |
Subject: |
[hurd] 19/20: fakeroot: Fix reopening files after a chmod |
Date: |
Sat, 23 May 2015 05:09:42 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch upstream
in repository hurd.
commit ef1312fb2e17d15d695dc29be9c3abc25584ba10
Author: Samuel Thibault <address@hidden>
Date: Sat May 23 02:18:03 2015 +0530
fakeroot: Fix reopening files after a chmod
Huge thanks to Svante Signell for having tracked the bug.
* trans/fakeroot.c (netfs_attempt_chmod): Make the file_chmod call
additionally include the modes from nn->openmodes.
---
trans/fakeroot.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/trans/fakeroot.c b/trans/fakeroot.c
index 51be60c..63303a0 100644
--- a/trans/fakeroot.c
+++ b/trans/fakeroot.c
@@ -544,14 +544,28 @@ real_from_fake_mode (mode_t mode)
error_t
netfs_attempt_chmod (struct iouser *cred, struct node *np, mode_t mode)
{
+ struct netnode *nn;
+ mode_t real_mode;
+
if ((mode & S_IFMT) == 0)
mode |= np->nn_stat.st_mode & S_IFMT;
if ((mode & S_IFMT) != (np->nn_stat.st_mode & S_IFMT))
return EOPNOTSUPP;
+ /* Make sure that `check_openmodes' will still always be able to reopen
+ it. */
+ real_mode = mode;
+ nn = netfs_node_netnode (np);
+ if (nn->openmodes & O_READ)
+ real_mode |= S_IRUSR;
+ if (nn->openmodes & O_WRITE)
+ real_mode |= S_IWUSR;
+ if (nn->openmodes & O_EXEC)
+ real_mode |= S_IXUSR;
+
/* We don't bother with error checking since the fake mode change should
always succeed--worst case a later open will get EACCES. */
- (void) file_chmod (netfs_node_netnode (np)->file, mode);
+ (void) file_chmod (nn->file, real_mode);
set_faked_attribute (np, FAKE_MODE);
np->nn_stat.st_mode = mode;
return 0;
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] branch upstream updated (b69862c -> eef94c4), Samuel Thibault, 2015/05/23
- [hurd] 06/20: libdiskfs: make struct node more compact, Samuel Thibault, 2015/05/23
- [hurd] 07/20: libdiskfs: drop unused fields from struct node, Samuel Thibault, 2015/05/23
- [hurd] 08/20: libdiskfs: fix node initialization, Samuel Thibault, 2015/05/23
- [hurd] 14/20: Fix creating named sockets inside fakeroot-hurd, Samuel Thibault, 2015/05/23
- [hurd] 09/20: libdiskfs: declare all inline functions as `extern inline', Samuel Thibault, 2015/05/23
- [hurd] 20/20: Merge remote-tracking branch 'upstream/master' into upstream, Samuel Thibault, 2015/05/23
- [hurd] 18/20: Make comment clearer, Samuel Thibault, 2015/05/23
- [hurd] 19/20: fakeroot: Fix reopening files after a chmod,
Samuel Thibault <=
- [hurd] 16/20: fatfs: fix error handling, Samuel Thibault, 2015/05/23
- [hurd] 15/20: libdiskfs: fix renaming of directories, Samuel Thibault, 2015/05/23
- [hurd] 17/20: Make sure to record only RWX open modes, Samuel Thibault, 2015/05/23
- [hurd] 01/20: ext2fs: use a seperate lock to protect nodehash, Samuel Thibault, 2015/05/23
- [hurd] 04/20: tmpfs: use a seperate lock to protect all_nodes, Samuel Thibault, 2015/05/23
- [hurd] 03/20: isofs: use a seperate lock to protect node_cache, Samuel Thibault, 2015/05/23
- [hurd] 13/20: fatfs: port to libdiskfs' node cache, Samuel Thibault, 2015/05/23
- [hurd] 12/20: isofs: port to libdiskfs' node cache, Samuel Thibault, 2015/05/23
- [hurd] 05/20: libdiskfs: lock-less reference counting of nodes, Samuel Thibault, 2015/05/23
- [hurd] 02/20: fatfs: use a seperate lock to protect nodehash, Samuel Thibault, 2015/05/23