diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-01-01 13:30:19 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-01-01 14:04:51 +0100 |
commit | 938730662dd2ec407c28380de66c3053f05e3159 (patch) | |
tree | f434e727eee8988504416452e083dc64f1607d0e /libnetfs | |
parent | 08de8baa4917b20644f9340452825bceadad6693 (diff) | |
download | hurd-938730662dd2ec407c28380de66c3053f05e3159.tar.gz hurd-938730662dd2ec407c28380de66c3053f05e3159.tar.bz2 hurd-938730662dd2ec407c28380de66c3053f05e3159.zip |
Fix accessing cred before checking it is non-NULL
Diffstat (limited to 'libnetfs')
-rw-r--r-- | libnetfs/file-lock.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libnetfs/file-lock.c b/libnetfs/file-lock.c index 7bb81d43..2aa28458 100644 --- a/libnetfs/file-lock.c +++ b/libnetfs/file-lock.c @@ -30,7 +30,7 @@ netfs_S_file_lock (struct protid *user, error_t err; struct flock64 lock; struct node *node; - int openstat = user->po->openstat; + int openstat; mach_port_t rendezvous = MACH_PORT_NULL; if (!user) @@ -54,6 +54,7 @@ netfs_S_file_lock (struct protid *user, From flock(2): A shared or exclusive lock can be placed on a file regardless of the mode in which the file was opened. */ + openstat = user->po->openstat; if (openstat & (O_RDONLY|O_WRONLY|O_EXEC)) openstat |= O_RDONLY|O_WRONLY; node = user->po->np; |