[pseudo][PATCH 2/6] pseudo_client.h: Make it clear both macros must be updated together
Mark Hatle <[email protected]>
| Newsgroups | org.yoctoproject.lists.yocto-patches |
|---|---|
| Message-ID | <[email protected]> |
From: Mark Hatle <[email protected]> Both PSEUDO_FS_MODE and PSEUDO_DB_MODE must be updated together. The first defined the masking for the mode on the disk, while the second filters the masking so we know which modes from the disk can be trusted. Signed-off-by: Mark Hatle <[email protected]> Signed-off-by: Mark Hatle <[email protected]> --- pseudo_client.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pseudo_client.h b/pseudo_client.h index e963d95..b5ec204 100644 --- a/pseudo_client.h +++ b/pseudo_client.h @@ -87,7 +87,10 @@ extern int read_pidfile(FILE *, int *); * When doing anything which actually writes to the filesystem, we add in * the user read/write/execute bits. When storing to the database, though, * we mask out any such bits which weren't in the original mode. + * + * Note: PSEUDO_DB_MODE must be kept in sync with PSEUDO_FS_MODE, as the + * former defined which filesystem mode bits must be loaded from the DB. */ #define PSEUDO_FS_MODE(mode, isdir) (((mode) | S_IRUSR | S_IWUSR | ((isdir) ? S_IXUSR : 0)) & ~(S_IWGRP | S_IWOTH)) -#define PSEUDO_DB_MODE(fs_mode, user_mode) (((fs_mode) & ~0722) | ((user_mode & 0722))) +#define PSEUDO_DB_MODE(fs_mode, user_mode) (((fs_mode) & ~(S_IRUSR | S_IWUSR | S_IXUSR | S_IWGRP | S_IWOTH)) | ((user_mode) & (S_IRUSR | S_IWUSR | S_IXUSR | S_IWGRP | S_IWOTH))) -- 1.8.3.1