diff options
author | Fernando Carvajal <fcarvajal@qindel.com> | 2016-04-25 12:53:00 +0200 |
---|---|---|
committer | Fernando Carvajal <fcarvajal@qindel.com> | 2016-04-27 12:46:00 +0200 |
commit | a436cba04834da945d4a2be5335d1d7e95c6bf08 (patch) | |
tree | bcbcc29b01a86d2035e7397ded5b24b90c841645 /nxcomp/Loop.cpp | |
parent | 12104a232a6de163f7e871be288ac933083c4226 (diff) | |
download | nx-libs-a436cba04834da945d4a2be5335d1d7e95c6bf08.tar.gz nx-libs-a436cba04834da945d4a2be5335d1d7e95c6bf08.tar.bz2 nx-libs-a436cba04834da945d4a2be5335d1d7e95c6bf08.zip |
Clean up compiler warnings in nxcomp
This commit removes several warnings in nxcomp related to unused but
set variables. It also replaces tempnam function with the more secure
one mkstemp and there has been removed another warning related to
setgid and setuid returning values not being checked.
So these were the compiler warnings in nxcomp that have been fixed:
Loop.cpp: In function ‘int ParseRemoteOptions(char*)’:
Loop.cpp:9423:7: warning: variable ‘hasLimit’ set but not used [-Wunused-but-set-variable]
int hasLimit = 0;
^
Loop.cpp:9424:7: warning: variable ‘hasRender’ set but not used [-Wunused-but-set-variable]
int hasRender = 0;
^
Loop.cpp:9425:7: warning: variable ‘hasTaint’ set but not used [-Wunused-but-set-variable]
int hasTaint = 0;
^
Loop.cpp:9427:7: warning: variable ‘hasStrict’ set but not used [-Wunused-but-set-variable]
int hasStrict = 0;
^
Loop.cpp:9428:7: warning: variable ‘hasShseg’ set but not used [-Wunused-but-set-variable]
int hasShseg = 0;
^
ServerChannel.cpp: In member function ‘virtual int ServerChannel::handleWrite(const unsigned char*, unsigned int)’:
ServerChannel.cpp:2132:9: warning: variable ‘hit’ set but not used [-Wunused-but-set-variable]
int hit;
^
Proxy.o: In function `Proxy::handleSaveAllStores(char const*) const':
Proxy.cpp:(.text+0x2cac): warning: the use of `tempnam' is dangerous, better use `mkstemp'
Pipe.cpp: In function ‘FILE* Popen(char* const*, const char*)’:
Pipe.cpp:240:23: warning: ignoring return value of ‘int setgid(__gid_t)’,
declared with attribute warn_unused_result [-Wunused-result]
setgid(getgid());
^
Pipe.cpp:241:23: warning: ignoring return value of ‘int setuid(__uid_t)’,
declared with attribute warn_unused_result [-Wunused-result]
setuid(getuid());
^
There was also a hidden problem in the way Proxy::handleSaveAllStores was
checking for an error in the returning value from the call to the virtual
method handleSaveAllStores of the specific proxy class really being used
(ClientProxy or ServerProxy).
Former code was considering the value 0 as the returning value in case of
an error whereas both subclasses return the value -1 when there is an error
in their handleSaveAllStores method.
This bug has been fixed in this commit taking advantage of the modification
that was already being made to this method in order to replace tempnam
function with the more secure one mkstemp.
Fixes: ArcticaProject/nx-libs#103
Diffstat (limited to 'nxcomp/Loop.cpp')
-rw-r--r-- | nxcomp/Loop.cpp | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/nxcomp/Loop.cpp b/nxcomp/Loop.cpp index 0f9fec6ef..a60bfc9ae 100644 --- a/nxcomp/Loop.cpp +++ b/nxcomp/Loop.cpp @@ -9393,12 +9393,7 @@ int ParseRemoteOptions(char *opts) int hasDelta = 0; int hasStream = 0; int hasData = 0; - int hasLimit = 0; - int hasRender = 0; - int hasTaint = 0; int hasType = 0; - int hasStrict = 0; - int hasShseg = 0; // // Get rid of the terminating space. @@ -9623,7 +9618,6 @@ int ParseRemoteOptions(char *opts) } } - hasLimit = 1; } else if (strcasecmp(name, "render") == 0) { @@ -9636,7 +9630,6 @@ int ParseRemoteOptions(char *opts) useRender = ValidateArg("remote", name, value); } - hasRender = 1; } else if (strcasecmp(name, "taint") == 0) { @@ -9649,7 +9642,6 @@ int ParseRemoteOptions(char *opts) useTaint = ValidateArg("remote", name, value); } - hasTaint = 1; } else if (strcasecmp(name, "type") == 0) { @@ -9682,7 +9674,6 @@ int ParseRemoteOptions(char *opts) useStrict = ValidateArg("remote", name, value); } - hasStrict = 1; } else if (strcasecmp(name, "shseg") == 0) { @@ -9704,7 +9695,6 @@ int ParseRemoteOptions(char *opts) return -1; } - hasShseg = 1; } else if (strcasecmp(name, "delta") == 0) { |