Silence GCC compiler warnings about unused return value from fchown().
FossilOrigin-Name: b022547389a40930cf0d2a75f5eb293acc9fbfe0
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
C Another\sattempt\sto\sfix\swarnings\sin\sthe\srandomFunc()\sfunction.
|
||||
D 2012-02-11T19:53:24.226
|
||||
C Silence\sGCC\scompiler\swarnings\sabout\sunused\sreturn\svalue\sfrom\sfchown().
|
||||
D 2012-02-11T21:21:17.335
|
||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||
F Makefile.in 3f79a373e57c3b92dabf76f40b065e719d31ac34
|
||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||
@@ -166,7 +166,7 @@ F src/os.c e1acdc09ff3ac2412945cca9766e2dcf4675f31c
|
||||
F src/os.h 59beba555b65a450bd1d804220532971d4299f60
|
||||
F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
|
||||
F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440
|
||||
F src/os_unix.c f7e7b3e4f6922e3b07250a22c81da766ac2cc8fa
|
||||
F src/os_unix.c 3dd0399fe024df37af2980c99f1a3c1d3cc6a782
|
||||
F src/os_win.c 5ac061ae1326a71500cee578ed0fd9113b4f6a37
|
||||
F src/pager.c 2d892f7b901a8867a33bc21742086165a3a99af8
|
||||
F src/pager.h a435da8421dc7844b7f9c7f37b636c160c50208a
|
||||
@@ -989,7 +989,7 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06
|
||||
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
||||
F tool/warnings-clang.sh 9f406d66e750e8ac031c63a9ef3248aaa347ef2a
|
||||
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
|
||||
P 1254dffe4071656a783cd000b1dd40c975ac18cb
|
||||
R d9fa00aa327e93350ee48bb2f6ecc475
|
||||
P 768df4e11670ac704d96e3b601d009aaa2fd793a
|
||||
R 356443deb3c82ed63a280950a7c5c72e
|
||||
U drh
|
||||
Z 4e53a459dae4b9322244fc7645ecba60
|
||||
Z 590e6955e1a8261beb6491e7ffa39206
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
768df4e11670ac704d96e3b601d009aaa2fd793a
|
||||
b022547389a40930cf0d2a75f5eb293acc9fbfe0
|
||||
+12
-6
@@ -211,7 +211,7 @@ struct unixFile {
|
||||
unixInodeInfo *pInode; /* Info about locks on this inode */
|
||||
int h; /* The file descriptor */
|
||||
unsigned char eFileLock; /* The type of lock held on this fd */
|
||||
unsigned char ctrlFlags; /* Behavioral bits. UNIXFILE_* flags */
|
||||
unsigned short int ctrlFlags; /* Behavioral bits. UNIXFILE_* flags */
|
||||
int lastErrno; /* The unix errno from last I/O error */
|
||||
void *lockingContext; /* Locking style specific state */
|
||||
UnixUnusedFd *pUnused; /* Pre-allocated UnixUnusedFd */
|
||||
@@ -262,6 +262,7 @@ struct unixFile {
|
||||
#define UNIXFILE_DELETE 0x20 /* Delete on close */
|
||||
#define UNIXFILE_URI 0x40 /* Filename might have query parameters */
|
||||
#define UNIXFILE_NOLOCK 0x80 /* Do no file locking */
|
||||
#define UNIXFILE_CHOWN 0x100 /* File ownership was changed */
|
||||
|
||||
/*
|
||||
** Include code that is common to all os_*.c files
|
||||
@@ -3908,9 +3909,13 @@ static int unixOpenSharedMemory(unixFile *pDbFd){
|
||||
/* If this process is running as root, make sure that the SHM file
|
||||
** is owned by the same user that owns the original database. Otherwise,
|
||||
** the original owner will not be able to connect. If this process is
|
||||
** not root, the following fchown() will fail, but we don't care.
|
||||
** not root, the following fchown() will fail, but we don't care. The
|
||||
** if(){..} and the UNIXFILE_CHOWN flag are purely to silence compiler
|
||||
** warnings.
|
||||
*/
|
||||
fchown(pShmNode->h, sStat.st_uid, sStat.st_gid);
|
||||
if( fchown(pShmNode->h, sStat.st_uid, sStat.st_gid)==0 ){
|
||||
pDbFd->ctrlFlags |= UNIXFILE_CHOWN;
|
||||
}
|
||||
|
||||
/* Check to see if another process is holding the dead-man switch.
|
||||
** If not, truncate the file to zero length.
|
||||
@@ -5119,11 +5124,12 @@ static int unixOpen(
|
||||
/* If this process is running as root and if creating a new rollback
|
||||
** journal or WAL file, set the ownership of the journal or WAL to be
|
||||
** the same as the original database. If we are not running as root,
|
||||
** then the fchown() call will fail, but that's ok - there is nothing
|
||||
** we can do about it so just ignore the error.
|
||||
** then the fchown() call will fail, but that's ok. The "if(){}" and
|
||||
** the setting of the UNIXFILE_CHOWN flag are purely to silence compiler
|
||||
** warnings from gcc.
|
||||
*/
|
||||
if( flags & (SQLITE_OPEN_WAL|SQLITE_OPEN_MAIN_JOURNAL) ){
|
||||
fchown(fd, uid, gid);
|
||||
if( fchown(fd, uid, gid)==0 ){ p->ctrlFlags |= UNIXFILE_CHOWN; }
|
||||
}
|
||||
}
|
||||
assert( fd>=0 );
|
||||
|
||||
Reference in New Issue
Block a user