mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-15 04:32:24 +00:00
lidtsvc: coverity fixes
This commit is contained in:
parent
91bb9a037a
commit
691dffb076
17 changed files with 52 additions and 20 deletions
|
@ -28,6 +28,7 @@
|
||||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||||
* (c) Copyright 1993, 1994 Novell, Inc.
|
* (c) Copyright 1993, 1994 Novell, Inc.
|
||||||
*/
|
*/
|
||||||
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -274,7 +275,7 @@ _SHXbuf::filegen()
|
||||||
{
|
{
|
||||||
long i;
|
long i;
|
||||||
// compare all entries to a copy of the first entry
|
// compare all entries to a copy of the first entry
|
||||||
strcpy(filebuf, &bufptr[long(vec[0])]);
|
snprintf(filebuf, sizeof(filebuf), "%s", &bufptr[long(vec[0])]);
|
||||||
|
|
||||||
for (i = 1; i < vec.size(); i++)
|
for (i = 1; i < vec.size(); i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -74,6 +74,7 @@ XeCreateContextString(XeString host,
|
||||||
|
|
||||||
if ((strequal(directory, (XeString)"")) || (directory == NULL)){
|
if ((strequal(directory, (XeString)"")) || (directory == NULL)){
|
||||||
if ((strequal(file, (XeString)"")) || (file == NULL)){
|
if ((strequal(file, (XeString)"")) || (file == NULL)){
|
||||||
|
Xe_release_str(host);
|
||||||
return((XeString) NULL);
|
return((XeString) NULL);
|
||||||
} else {
|
} else {
|
||||||
context_string = XeMalloc (strlen(host) + strlen(file) + 2);
|
context_string = XeMalloc (strlen(host) + strlen(file) + 2);
|
||||||
|
|
|
@ -197,6 +197,7 @@ static char * get_tmp_dir (
|
||||||
if (is_dir_usable (dir))
|
if (is_dir_usable (dir))
|
||||||
return (dir);
|
return (dir);
|
||||||
|
|
||||||
|
free(dir);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,6 +89,7 @@ Wire *getpipe(Wire *prevwire)
|
||||||
/* Get file descriptors for pipe */
|
/* Get file descriptors for pipe */
|
||||||
if (pipe(wire_ptr->fd) < OK) {
|
if (pipe(wire_ptr->fd) < OK) {
|
||||||
SPC_Error(SPC_No_Pipe);
|
SPC_Error(SPC_No_Pipe);
|
||||||
|
XeFree(wire_ptr);
|
||||||
return(SPC_ERROR);
|
return(SPC_ERROR);
|
||||||
}
|
}
|
||||||
return(wire_ptr);
|
return(wire_ptr);
|
||||||
|
|
|
@ -441,8 +441,10 @@ int exec_proc_local_channel_object(SPC_Channel_Ptr channel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mempf0(channel, pre_fork)==SPC_ERROR)
|
if(mempf0(channel, pre_fork)==SPC_ERROR) {
|
||||||
return(SPC_ERROR);
|
XeFree(dir);
|
||||||
|
return(SPC_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
/* When using HP NLIO (xj0input) we have a problem. Namely, */
|
/* When using HP NLIO (xj0input) we have a problem. Namely, */
|
||||||
/* the xj0 processs uses signal() to deal with SIGCLD which */
|
/* the xj0 processs uses signal() to deal with SIGCLD which */
|
||||||
|
@ -458,8 +460,10 @@ int exec_proc_local_channel_object(SPC_Channel_Ptr channel)
|
||||||
sigemptyset(&oldsigmask);
|
sigemptyset(&oldsigmask);
|
||||||
sigaddset(&newsigmask, SIGCHLD);
|
sigaddset(&newsigmask, SIGCHLD);
|
||||||
|
|
||||||
if (sigprocmask(SIG_BLOCK, &newsigmask, &oldsigmask) == ERROR)
|
if (sigprocmask(SIG_BLOCK, &newsigmask, &oldsigmask) == ERROR) {
|
||||||
return(SPC_ERROR);
|
XeFree(dir);
|
||||||
|
return(SPC_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
pid = channel->pid = fork();
|
pid = channel->pid = fork();
|
||||||
|
|
||||||
|
|
|
@ -344,8 +344,10 @@ SPC_Contact_Server(SPC_Connection_Ptr connection)
|
||||||
memcpy(&saddr.sin_addr, remote->h_addr, remote->h_length);
|
memcpy(&saddr.sin_addr, remote->h_addr, remote->h_length);
|
||||||
|
|
||||||
if(connect(connection->sid, (struct sockaddr *)&saddr, sizeof(saddr)) == ERROR) {
|
if(connect(connection->sid, (struct sockaddr *)&saddr, sizeof(saddr)) == ERROR) {
|
||||||
SPC_Error(SPC_Bad_Connect,
|
XeString shorthost = XeFindShortHost(remote->h_name);
|
||||||
XeFindShortHost(remote->h_name));
|
SPC_Error(SPC_Bad_Connect, shorthost);
|
||||||
|
XeFree(shorthost);
|
||||||
|
|
||||||
return(SPC_ERROR);
|
return(SPC_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -768,8 +768,10 @@ int SPC_Write_Protocol_Request (SPC_Connection_Ptr connection,
|
||||||
envp=va_arg(ap, XeString *);
|
envp=va_arg(ap, XeString *);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
pdata->len=WRITE_APPLICATION_SPAWN(pdata, path, dir, argv, envp);
|
pdata->len=WRITE_APPLICATION_SPAWN(pdata, path, dir, argv, envp);
|
||||||
if(pdata->len == SPC_ERROR)
|
if(pdata->len == SPC_ERROR) {
|
||||||
|
SPC_Free_Protocol_Ptr(prot_request);
|
||||||
return(SPC_ERROR);
|
return(SPC_ERROR);
|
||||||
|
}
|
||||||
prot_name=(XeString)" <-- APPLICATION_SPAWN";
|
prot_name=(XeString)" <-- APPLICATION_SPAWN";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -929,6 +931,7 @@ int SPC_Write_Protocol_Request (SPC_Connection_Ptr connection,
|
||||||
if(connection->protocol_version < 3) {
|
if(connection->protocol_version < 3) {
|
||||||
SPC_Error(SPC_Protocol_Version_Error,
|
SPC_Error(SPC_Protocol_Version_Error,
|
||||||
3, channel->connection->protocol_version);
|
3, channel->connection->protocol_version);
|
||||||
|
SPC_Free_Protocol_Ptr(prot_request);
|
||||||
return(SPC_ERROR);
|
return(SPC_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -940,6 +943,7 @@ int SPC_Write_Protocol_Request (SPC_Connection_Ptr connection,
|
||||||
if(connection->protocol_version < 3) {
|
if(connection->protocol_version < 3) {
|
||||||
SPC_Error(SPC_Protocol_Version_Error,
|
SPC_Error(SPC_Protocol_Version_Error,
|
||||||
3, channel->connection->protocol_version);
|
3, channel->connection->protocol_version);
|
||||||
|
SPC_Free_Protocol_Ptr(prot_request);
|
||||||
return(SPC_ERROR);
|
return(SPC_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -958,6 +962,7 @@ int SPC_Write_Protocol_Request (SPC_Connection_Ptr connection,
|
||||||
buffer = SPC_Decode_Termios(termios_ptr);
|
buffer = SPC_Decode_Termios(termios_ptr);
|
||||||
pdata->len=WRITE_TERMIOS(pdata, connector, side, buffer);
|
pdata->len=WRITE_TERMIOS(pdata, connector, side, buffer);
|
||||||
prot_name=(XeString)" <-- CHANNEL_TERMIOS";
|
prot_name=(XeString)" <-- CHANNEL_TERMIOS";
|
||||||
|
free(buffer);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -965,6 +970,7 @@ int SPC_Write_Protocol_Request (SPC_Connection_Ptr connection,
|
||||||
if(connection->protocol_version < 3) {
|
if(connection->protocol_version < 3) {
|
||||||
SPC_Error(SPC_Protocol_Version_Error,
|
SPC_Error(SPC_Protocol_Version_Error,
|
||||||
3, channel->connection->protocol_version);
|
3, channel->connection->protocol_version);
|
||||||
|
SPC_Free_Protocol_Ptr(prot_request);
|
||||||
return(SPC_ERROR);
|
return(SPC_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1229,8 +1235,10 @@ char **SPC_Get_Multi_Packet(SPC_Connection_Ptr connection,
|
||||||
if(localprot)
|
if(localprot)
|
||||||
SPC_Free_Protocol_Ptr(localprot);
|
SPC_Free_Protocol_Ptr(localprot);
|
||||||
prot=SPC_Filter_Connection(connection, NULL, request, TRUE);
|
prot=SPC_Filter_Connection(connection, NULL, request, TRUE);
|
||||||
if(prot==SPC_ERROR)
|
if(prot==SPC_ERROR) {
|
||||||
return(SPC_ERROR);
|
free(out);
|
||||||
|
return(SPC_ERROR);
|
||||||
|
}
|
||||||
print_protocol_request(name, prot);
|
print_protocol_request(name, prot);
|
||||||
localprot=prot;
|
localprot=prot;
|
||||||
bufptr=PDRP(prot->dataptr);
|
bufptr=PDRP(prot->dataptr);
|
||||||
|
@ -1442,6 +1450,8 @@ sscan_application_data(XeString buf,
|
||||||
*envp=sscan_counted_string(bufptr, &bufptr);
|
*envp=sscan_counted_string(bufptr, &bufptr);
|
||||||
if(*envp==SPC_ERROR)
|
if(*envp==SPC_ERROR)
|
||||||
return(SPC_ERROR);
|
return(SPC_ERROR);
|
||||||
|
|
||||||
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*----------------------------------------------------------------------+*/
|
/*----------------------------------------------------------------------+*/
|
||||||
|
@ -1657,7 +1667,7 @@ int SPC_Query_Logfile(SPC_Channel_Ptr channel)
|
||||||
|
|
||||||
READ_LOGFILE_REPLY(prot->dataptr, &channel->logfile, &junk1, &junk2);
|
READ_LOGFILE_REPLY(prot->dataptr, &channel->logfile, &junk1, &junk2);
|
||||||
if (junk1) XeFree(junk1);
|
if (junk1) XeFree(junk1);
|
||||||
if (junk1) XeFree(junk2);
|
if (junk2) XeFree(junk2);
|
||||||
|
|
||||||
SPC_Free_Protocol_Ptr(prot);
|
SPC_Free_Protocol_Ptr(prot);
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
|
@ -1811,6 +1821,7 @@ SPC_Validate_User(XeString hostname,
|
||||||
tt_free (path);
|
tt_free (path);
|
||||||
XeFree(connection_hostname);
|
XeFree(connection_hostname);
|
||||||
if (logfile) XeFree(logfile);
|
if (logfile) XeFree(logfile);
|
||||||
|
close(open_status);
|
||||||
return(SPC_ERROR);
|
return(SPC_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1598,6 +1598,7 @@ CreateInvocationRecord(
|
||||||
SET_INV_ERROR(invp->state);
|
SET_INV_ERROR(invp->state);
|
||||||
SET_INV_CANCEL(invp->state);
|
SET_INV_CANCEL(invp->state);
|
||||||
|
|
||||||
|
close(fd);
|
||||||
return invp;
|
return invp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -446,7 +446,7 @@ _DtActValidateFieldValue( long bit, char *value, char *actName, char *filename)
|
||||||
val, _DtACTION_ARG_MODE);
|
val, _DtACTION_ARG_MODE);
|
||||||
_DtSimpleError(DtProgName,DtError, NULL, "%s", buf);
|
_DtSimpleError(DtProgName,DtError, NULL, "%s", buf);
|
||||||
free(val);
|
free(val);
|
||||||
buf = malloc(_DtAct_MAX_BUF_SIZE);
|
free(buf);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
break; /* valid value */
|
break; /* valid value */
|
||||||
|
@ -1027,7 +1027,7 @@ _DtActionConverter(DtDtsDbField * fields,
|
||||||
sprintf (buf, missingName, _DtACTION_NAME, fileName);
|
sprintf (buf, missingName, _DtACTION_NAME, fileName);
|
||||||
_DtSimpleError(DtProgName,DtError, NULL, "%s", buf);
|
_DtSimpleError(DtProgName,DtError, NULL, "%s", buf);
|
||||||
XtFree(fileName);
|
XtFree(fileName);
|
||||||
if (buf) XtFree(buf);
|
XtFree(buf);
|
||||||
_DtSvcProcessUnlock();
|
_DtSvcProcessUnlock();
|
||||||
return(True);
|
return(True);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1393,7 +1393,7 @@ static void
|
||||||
_DtActMMGetTtMsgInfo(DtDtsMMRecord *actRecp, ActionPtr actp)
|
_DtActMMGetTtMsgInfo(DtDtsMMRecord *actRecp, ActionPtr actp)
|
||||||
{
|
{
|
||||||
char argNname[ sizeof(_DtACTION_TTN_ARG) /* space for prefix */
|
char argNname[ sizeof(_DtACTION_TTN_ARG) /* space for prefix */
|
||||||
+ 3 /* enough space for three decimal digits */
|
+ 9 /* enough space for three decimal digits */
|
||||||
+ sizeof(_DtACTION_TTN_REP_TYPE)]; /* space for longest suffix */
|
+ sizeof(_DtACTION_TTN_REP_TYPE)]; /* space for longest suffix */
|
||||||
int i;
|
int i;
|
||||||
char *s;
|
char *s;
|
||||||
|
@ -2165,6 +2165,7 @@ _DtActionFindDBEntry( ActionRequest *reqp,
|
||||||
if ( reqp )
|
if ( reqp )
|
||||||
SET_TOO_MANY_MAPS(reqp->mask);
|
SET_TOO_MANY_MAPS(reqp->mask);
|
||||||
_DtSvcProcessUnlock();
|
_DtSvcProcessUnlock();
|
||||||
|
free(mapto);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -484,6 +484,7 @@ dndFileContentsToSelectionValue(
|
||||||
buf = (void *)XtMalloc(bufLen + 1);
|
buf = (void *)XtMalloc(bufLen + 1);
|
||||||
|
|
||||||
bytesRead = read(fd, buf, bufLen);
|
bytesRead = read(fd, buf, bufLen);
|
||||||
|
close(fd);
|
||||||
|
|
||||||
if (bytesRead == -1 || bytesRead != bufLen) {
|
if (bytesRead == -1 || bytesRead != bufLen) {
|
||||||
XtFree((char *)buf);
|
XtFree((char *)buf);
|
||||||
|
|
|
@ -155,7 +155,8 @@ extern int cde_da_compare(DtDtsMMRecord **entry1, DtDtsMMRecord **entry2);
|
||||||
extern int cde_dc_field_compare(DtDtsMMField **entry1, DtDtsMMField **entry2);
|
extern int cde_dc_field_compare(DtDtsMMField **entry1, DtDtsMMField **entry2);
|
||||||
|
|
||||||
|
|
||||||
_DtDtsClear()
|
void
|
||||||
|
_DtDtsClear(void)
|
||||||
{
|
{
|
||||||
_DtSvcProcessLock();
|
_DtSvcProcessLock();
|
||||||
dtdts_path_pattern = 0;
|
dtdts_path_pattern = 0;
|
||||||
|
|
|
@ -69,6 +69,7 @@ typedef int (*genfunc)(const void *, const void *);
|
||||||
static DtDtsDbDatabase **db_list;
|
static DtDtsDbDatabase **db_list;
|
||||||
static int num_db = 0;
|
static int num_db = 0;
|
||||||
|
|
||||||
|
void
|
||||||
_DtDtsDbPrintFields(DtDtsDbRecord *rec_ptr, FILE *fd)
|
_DtDtsDbPrintFields(DtDtsDbRecord *rec_ptr, FILE *fd)
|
||||||
{
|
{
|
||||||
int fld;
|
int fld;
|
||||||
|
@ -84,6 +85,7 @@ _DtDtsDbPrintFields(DtDtsDbRecord *rec_ptr, FILE *fd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
_DtDtsDbPrintRecords(DtDtsDbDatabase *db_ptr, FILE *fd)
|
_DtDtsDbPrintRecords(DtDtsDbDatabase *db_ptr, FILE *fd)
|
||||||
{
|
{
|
||||||
int rec;
|
int rec;
|
||||||
|
|
|
@ -691,6 +691,7 @@ write_db(DtDtsMMHeader *header, void *index, int size, const char *CacheFile)
|
||||||
_DtSimpleError(
|
_DtSimpleError(
|
||||||
DtProgName, DtError, NULL,
|
DtProgName, DtError, NULL,
|
||||||
(char*) tmpfile, NULL);
|
(char*) tmpfile, NULL);
|
||||||
|
free(tmpfile);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1293,7 +1293,7 @@ _DtWsmSetBackdropSearchPath (
|
||||||
|
|
||||||
if (postDtEnvironmentString != postDtEnvironmentStringBuf)
|
if (postDtEnvironmentString != postDtEnvironmentStringBuf)
|
||||||
{
|
{
|
||||||
if (postDtEnvironmentString) XtFree(postDtEnvironmentString);
|
XtFree(postDtEnvironmentString);
|
||||||
postDtEnvironmentString = NULL;
|
postDtEnvironmentString = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,9 @@ _DtPrintDefaultError(
|
||||||
{
|
{
|
||||||
_DtPrintDefaultErrorSafe(dpy, event, msg, BUFSIZ);
|
_DtPrintDefaultErrorSafe(dpy, event, msg, BUFSIZ);
|
||||||
/* XXX retval? */
|
/* XXX retval? */
|
||||||
|
|
||||||
|
/* COV: 87468 nothing actually checks this return value */
|
||||||
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define _DTP_STRNCAT(s1, s2, nb, ec) \
|
#define _DTP_STRNCAT(s1, s2, nb, ec) \
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
@ -322,8 +323,8 @@ GetDisplayName (
|
||||||
/*
|
/*
|
||||||
* Create the display name and append it to the current path.
|
* Create the display name and append it to the current path.
|
||||||
*/
|
*/
|
||||||
(void)strcpy(hostName, display->display_name);
|
snprintf(hostName, sizeof(hostName), "%s", display->display_name);
|
||||||
(void)strcpy(displayName, display->display_name);
|
snprintf(displayName, sizeof(displayName), "%s", display->display_name);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If this is run to unix or local get the host name - otherwise
|
* If this is run to unix or local get the host name - otherwise
|
||||||
|
|
Loading…
Reference in a new issue