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 more static analysis warnings

This commit is contained in:
Peter Howkins 2014-12-27 23:13:59 +00:00
parent c768260785
commit ab743c37e6
9 changed files with 30 additions and 11 deletions

View file

@ -565,7 +565,7 @@ binaryEqual (char *a, char *b, unsigned short len)
return 1;
}
int
static void
dumpBytes (unsigned short len, char *data)
{
unsigned short i;
@ -709,7 +709,7 @@ writeAuth (file, auth)
dumpAuth (auth); /* does Debug only */
}
if (doWrite)
if (doWrite) {
if (!XauWriteAuth (file, auth) || fflush (file) == EOF) {
LogError(
ReadCatalog(MC_LOG_SET,MC_LOG_SRV_WRT,MC_DEF_LOG_SRV_WRT),
@ -717,7 +717,11 @@ writeAuth (file, auth)
return 0;
}
else
{
return 1;
}
}
return 1;
}
static void

View file

@ -425,6 +425,7 @@ ProcessChooserSocket (
}
close (client_fd);
return 1;
}
void

View file

@ -397,7 +397,6 @@ AddHostname (ARRAY8Ptr hostname, ARRAY8Ptr status, struct sockaddr *addr, int wi
}
if (!XdmcpAllocARRAY8 (&new->hostaddr, hostAddr.length))
{
free ((char *) new->fullname);
free ((char *) new);
return 0;
}
@ -759,6 +758,9 @@ Choose (HostName *h)
addr = (struct sockaddr *) &in_addr;
len = sizeof (in_addr);
break;
default:
fprintf (stderr, "Unhandled protocol family %d\n", family);
exit (REMANAGE_DISPLAY);
}
if ((fd = socket (family, SOCK_STREAM, 0)) == -1)
{

View file

@ -171,7 +171,8 @@ void
TrimErrorFile( void )
{
int f1, f2;
int f1 = -1;
int f2 = -1;
int deleteBytes;
char buf[BUFSIZ];

View file

@ -210,6 +210,7 @@ ParseDisplay( char *source,
LogError(ReadCatalog(MC_LOG_SET,MC_LOG_MISS_TYPE,MC_DEF_LOG_MISS_TYPE),
args[0]);
freeArgs (args);
free(name);
return 0;
}

View file

@ -478,6 +478,8 @@ InitCryptoKey( void )
}
cryptoInited = 1;
return 1;
}
#endif /* HASXDMAUTH */

View file

@ -164,14 +164,16 @@ Willing(
#endif
ret = AcceptableDisplayAddress (addr, connectionType, type);
if (!ret)
sprintf (statusBuf, "Display not authorized to connect");
snprintf (statusBuf, sizeof(statusBuf), "Display not authorized to connect");
else
sprintf (statusBuf, "%s", WillingMsg());
snprintf (statusBuf, sizeof(statusBuf), "%s", WillingMsg());
#if 0
sprintf (statusBuf, "host %s", localHostname());
snprintf (statusBuf, sizeof(statusBuf), "host %s", localHostname());
#endif
/* enforce termination */
statusBuf[255] = '\0';
status->length = strlen (statusBuf);
status->length = strlen(statusBuf);
status->data = (CARD8Ptr) malloc (status->length);
if (!status->data)
status->length = 0;

View file

@ -644,7 +644,7 @@ int
LoadXloginResources( struct display *d )
{
char cmd[1024];
char *language="";
char *language = NULL;
char *lang_key="";
char *authority="";
char *auth_key="";
@ -1943,6 +1943,8 @@ RunGreeter( struct display *d, struct greet_info *greet,
char *path;
struct greet_state state = {};
int notify_dt;
int dupfp = -1;
int dupfp2 = -1;
#ifdef __PASSWD_ETC
# ifndef U_NAMELEN
@ -2126,7 +2128,8 @@ RunGreeter( struct display *d, struct greet_info *greet,
* Writing to file descriptor 1 goes to response pipe instead.
*/
close(1);
if(-1 == dup(response[1])) {
dupfp = dup(response[1]);
if(-1 == dupfp) {
perror(strerror(errno));
}
close(response[0]);
@ -2136,7 +2139,8 @@ RunGreeter( struct display *d, struct greet_info *greet,
* Reading from file descriptor 0 reads from request pipe instead.
*/
close(0);
if(-1 == dup(request[0])) {
dupfp2 = dup(request[0]);
if(-1 == dupfp2) {
perror(strerror(errno));
}
close(request[0]);

View file

@ -1242,6 +1242,8 @@ RequestCB(
XmFONTLIST_DEFAULT_TAG));
string = XmStringConcat(xmstr, XmStringSeparatorCreate());
}
fclose(fp);
}
else
{