1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00

dtlogin: Resolve 27 compiler warnings

This commit is contained in:
Peter Howkins 2014-12-23 22:01:51 +00:00
parent 407aa2c4b7
commit bc842043d2
12 changed files with 90 additions and 34 deletions

View file

@ -220,7 +220,7 @@ FreeDisplayEntry(
free (d->entry.displayPattern);
break;
case DISPLAY_ADDRESS:
XdmcpDisposeARRAY8 (&d->entry.displayAddress);
XdmcpDisposeARRAY8 (&d->entry.displayAddress.clientAddress);
break;
}
for (h = d->hosts; h; h = next) {

View file

@ -291,7 +291,9 @@ Account( struct display *d, char *user, char *line, pid_t pid,
*/
if ((fd = open(WTMP_FILE, O_WRONLY | O_APPEND)) >= 0) {
write(fd, u, sizeof(utmp));
if(-1 == write(fd, u, sizeof(utmp))) {
perror(strerror(errno));
}
close(fd);
}

View file

@ -361,10 +361,18 @@ MakeServerAuthFile (struct display *d)
sprintf (d->authFile, "%s/%s", authDir, authdir1);
r = stat(d->authFile, &statb);
if (r == 0) {
if (statb.st_uid != 0)
(void) chown(d->authFile, 0, statb.st_gid);
if ((statb.st_mode & 0077) != 0)
(void) chmod(d->authFile, statb.st_mode & 0700);
if (statb.st_uid != 0) {
if(-1 == chown(d->authFile, 0, statb.st_gid)) {
perror(strerror(errno));
return FALSE;
}
}
if ((statb.st_mode & 0077) != 0) {
if(-1 == chmod(d->authFile, statb.st_mode & 0700)) {
perror(strerror(errno));
return FALSE;
}
}
} else {
if (errno == ENOENT)
r = mkdir(d->authFile, 0700);
@ -1284,11 +1292,15 @@ SetUserAuthorization (struct display *d, struct verify_info *verify)
#ifdef NGROUPS
Debug ("SetUserAuthorization: chown(%s,%d,%d)\n",
envname, verify->uid, verify->groups[0]);
chown (envname, verify->uid, verify->groups[0]);
if(-1 == chown (envname, verify->uid, verify->groups[0])) {
perror(strerror(errno));
}
#else
Debug ("SetUserAuthorization: chown(%s,%d,%d)\n",
envname, verify->uid, verify->gid);
chown (envname, verify->uid, verify->gid);
if(-1 == chown (envname, verify->uid, verify->gid)) {
perror(strerror(errno));
}
#endif /* NGROUPS */
}
}

View file

@ -777,7 +777,9 @@ Choose (HostName *h)
XdmcpWriteARRAY8 (&buffer, app_resources.clientAddress);
XdmcpWriteCARD16 (&buffer, (CARD16) app_resources.connectionType);
XdmcpWriteARRAY8 (&buffer, &h->hostaddr);
write (fd, (char *)buffer.data, buffer.pointer);
if(-1 == write (fd, (char *)buffer.data, buffer.pointer)) {
perror(strerror(errno));
}
close (fd);
}
else

View file

@ -252,16 +252,23 @@ TrimErrorFile( void )
* shift bytes to be saved to the beginning of the file...
*/
write (f1, p, n);
if(-1 == write (f1, p, n)) {
perror(strerror(errno));
}
while ( (n = read(f2, buf, BUFSIZ)) > 0 )
write(f1, buf, n);
while ( (n = read(f2, buf, BUFSIZ)) > 0 ) {
if(-1 == write(f1, buf, n)) {
perror(strerror(errno));
}
}
/*
* truncate file to new length and close file pointers...
*/
truncate(errorLogFile, statb.st_size - deleteBytes);
if(-1 == truncate(errorLogFile, statb.st_size - deleteBytes)) {
perror(strerror(errno));
}
close(f1);
close(f2);
}

View file

@ -262,7 +262,9 @@ WillingMsg( void )
strcat(tmpbuf,tmpfilename);
system(tmpbuf);
if(-1 == system(tmpbuf)) {
perror(strerror(errno));
}
if ((f = fopen(tmpfilename,"r")) != (FILE *) NULL) {
fgets(tmpbuf,LINEBUFSIZE,f);

View file

@ -63,7 +63,7 @@ static receivedUsr1;
*
***************************************************************************/
static char * _SysErrorMsg( int n) ;
static const char * _SysErrorMsg( int n) ;
static SIGVAL CatchUsr1( int arg ) ;
static void GetRemoteAddress( struct display *d, int fd) ;
static SIGVAL PingBlocked( int arg ) ;
@ -97,11 +97,11 @@ CatchUsr1( int arg )
++receivedUsr1;
}
static char *
static const char *
_SysErrorMsg( int n )
{
char *s = ((n >= 0 && n < sys_nerr) ? sys_errlist[n] : "unknown error");
const char *s = ((n >= 0 && n < sys_nerr) ? sys_errlist[n] : "unknown error");
return (s ? s : "no such error");
}
@ -146,8 +146,12 @@ StartServerOnce( struct display *d )
Debug ("Unable to set permissions on console devices ..\n");
else {
#endif
setgid (puser.pw_gid);
setuid (puser.pw_uid);
if(-1 == setgid (puser.pw_gid)) {
Debug ("setgid() failed setting %d\n", puser.pw_gid);
}
if(-1 == setuid (puser.pw_uid)) {
Debug ("setuid() failed setting %d\n", puser.pw_uid);
}
#ifdef sun
}
#endif

View file

@ -331,7 +331,7 @@ static int
IOErrorHandler( Display *dpy )
{
char *s = ((errno >= 0 && errno < sys_nerr) ? sys_errlist[errno]
const char *s = ((errno >= 0 && errno < sys_nerr) ? sys_errlist[errno]
: "unknown error");
LogError(ReadCatalog(
@ -712,7 +712,10 @@ LoadXloginResources( struct display *d )
auth_key, authority, d->xrdb, d->name, tmpname);
Debug ("Loading resource file: %s\n", cmd);
system (cmd);
if(-1 == system (cmd)) {
Debug ("system() failed on cmd '%s'\n", cmd);
return -1;
}
if (debugLevel <= 10)
if (unlink (tmpname) == -1)
@ -1518,7 +1521,9 @@ StartClient( struct verify_info *verify, struct display *d, int *pidp )
/* setpenv() will set gid for AIX */
#if !defined (_AIX)
setgid (verify->groups[0]);
if(-1 == setgid (verify->groups[0])) {
perror(strerror(errno));
}
#endif
# else /* ! NGROUPS */
@ -1570,7 +1575,9 @@ StartClient( struct verify_info *verify, struct display *d, int *pidp )
LogError (ReadCatalog(
MC_LOG_SET,MC_LOG_NO_HMDIR,MC_DEF_LOG_NO_HMDIR),
home, getEnv (verify->userEnviron, "USER"));
chdir ("/");
if(-1 == chdir ("/")) {
perror(strerror(errno));
}
verify->userEnviron = setEnv(verify->userEnviron,
"HOME", "/");
}
@ -1986,8 +1993,12 @@ RunGreeter( struct display *d, struct greet_info *greet,
* set up communication pipes...
*/
pipe(response);
pipe(request);
if(-1 == pipe(response)) {
perror(strerror(errno));
}
if(-1 == pipe(request)) {
perror(strerror(errno));
}
rbytes = 0;
@ -2115,7 +2126,9 @@ RunGreeter( struct display *d, struct greet_info *greet,
* Writing to file descriptor 1 goes to response pipe instead.
*/
close(1);
dup(response[1]);
if(-1 == dup(response[1])) {
perror(strerror(errno));
}
close(response[0]);
close(response[1]);
@ -2123,7 +2136,9 @@ RunGreeter( struct display *d, struct greet_info *greet,
* Reading from file descriptor 0 reads from request pipe instead.
*/
close(0);
dup(request[0]);
if(-1 == dup(request[0])) {
perror(strerror(errno));
}
close(request[0]);
close(request[1]);
@ -2138,7 +2153,7 @@ RunGreeter( struct display *d, struct greet_info *greet,
if ((p = (char *) strrchr(msg, '/')) == NULL)
strcpy(msg,"./");
else
*(++p) = NULL;
*(++p) = '\0';
strcat(msg,"dtgreet");
@ -2934,7 +2949,9 @@ static void
TellGreeter(
RequestHeader *phdr)
{
write(request[1], phdr, phdr->length);
if(-1 == write(request[1], phdr, phdr->length)) {
perror(strerror(errno));
}
}
static int

View file

@ -2336,8 +2336,9 @@ Audit( struct passwd *p, char *msg, int errnum )
/*
* make sure program is back to super-user...
*/
seteuid(0);
if(-1 == seteuid(0)) {
perror(strerror(errno));
}
return;
}

View file

@ -1941,5 +1941,7 @@ TellRequester(char * buf, size_t nbytes)
#ifdef VG_TRACE
vg_TRACE_EXECUTION("main: entered TellRequester ...");
#endif /* VG_TRACE */
write(1, buf, nbytes);
if(-1 == write(1, buf, nbytes)) {
perror(strerror(errno));
}
}

View file

@ -2177,7 +2177,9 @@ static SIGVAL
Terminate( int arg )
{
write(1, "terminate", 9);
if(-1 == write(1, "terminate", 9)) {
perror(strerror(errno));
}
CleanupAndExit(NULL, NOTIFY_ABORT);
}

View file

@ -119,6 +119,7 @@ extern ARRAY8Ptr ChooseAuthentication ();
extern int SelectConnectionTypeIndex ();
void query_respond (from, fromlen, length);
void broadcast_respond (struct sockaddr *from, int fromlen, int length);
void forward_respond (struct sockaddr *from, int fromlen, int length);
void request_respond (struct sockaddr *from, int fromlen, int length);
void send_willing (struct sockaddr *from, int fromlen, ARRAY8Ptr authenticationName, ARRAY8Ptr status);
@ -126,6 +127,10 @@ void send_unwilling (struct sockaddr *from, int fromlen, ARRAY8Ptr authenticatio
void send_accept (struct sockaddr *to, int tolen, CARD32 sessionID, ARRAY8Ptr authenticationName, ARRAY8Ptr authenticationData, ARRAY8Ptr authorizationName, ARRAY8Ptr authorizationData);
void manage (struct sockaddr *from, int fromlen, int length);
void send_decline (struct sockaddr *to, int tolen, ARRAY8Ptr authenticationName, ARRAY8Ptr authenticationData, ARRAY8Ptr status);
void send_failed (struct sockaddr *from, int fromlen, char *name, CARD32 sessionID, char *reason);
void send_refuse (struct sockaddr *from, int fromlen, CARD32 sessionID);
void send_alive (struct sockaddr *from, int fromlen, int length);
int xdmcpFd = -1;