mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-15 04:32:24 +00:00
Resolve some coverity warnings
This commit is contained in:
parent
35a16f47df
commit
637abd5d5c
10 changed files with 89 additions and 50 deletions
|
@ -313,8 +313,10 @@ _DtCm_check_cal_csa_attributes(
|
||||||
&realnum)) != CSA_SUCCESS)
|
&realnum)) != CSA_SUCCESS)
|
||||||
return (stat);
|
return (stat);
|
||||||
|
|
||||||
if (checkattrnum == B_TRUE && realnum == 0)
|
if (checkattrnum == B_TRUE && realnum == 0) {
|
||||||
|
free(hattrs);
|
||||||
return (CSA_E_INVALID_PARAMETER);
|
return (CSA_E_INVALID_PARAMETER);
|
||||||
|
}
|
||||||
|
|
||||||
stat = _DtCm_check_hashed_cal_attributes(fvers, hnum, hattrs,
|
stat = _DtCm_check_hashed_cal_attributes(fvers, hnum, hattrs,
|
||||||
NULL, cname, checkreadonly, firsttime, B_TRUE);
|
NULL, cname, checkreadonly, firsttime, B_TRUE);
|
||||||
|
@ -344,8 +346,10 @@ _DtCm_check_cal_cms_attributes(
|
||||||
&realnum)) != CSA_SUCCESS)
|
&realnum)) != CSA_SUCCESS)
|
||||||
return (stat);
|
return (stat);
|
||||||
|
|
||||||
if (checkattrnum == B_TRUE && realnum == 0)
|
if (checkattrnum == B_TRUE && realnum == 0) {
|
||||||
|
free(hattrs);
|
||||||
return (CSA_E_INVALID_PARAMETER);
|
return (CSA_E_INVALID_PARAMETER);
|
||||||
|
}
|
||||||
|
|
||||||
stat = _DtCm_check_hashed_cal_attributes(fvers, hnum, hattrs,
|
stat = _DtCm_check_hashed_cal_attributes(fvers, hnum, hattrs,
|
||||||
owner, cname, checkreadonly, firsttime, B_FALSE);
|
owner, cname, checkreadonly, firsttime, B_FALSE);
|
||||||
|
@ -372,8 +376,10 @@ _DtCm_check_entry_attributes(
|
||||||
&realnum)) != CSA_SUCCESS)
|
&realnum)) != CSA_SUCCESS)
|
||||||
return (stat);
|
return (stat);
|
||||||
|
|
||||||
if (checkattrnum == B_TRUE && realnum == 0)
|
if (checkattrnum == B_TRUE && realnum == 0) {
|
||||||
|
free(hattrs);
|
||||||
return (CSA_E_INVALID_PARAMETER);
|
return (CSA_E_INVALID_PARAMETER);
|
||||||
|
}
|
||||||
|
|
||||||
stat = _DtCm_check_hashed_entry_attributes(fvers, hnum, hattrs,
|
stat = _DtCm_check_hashed_entry_attributes(fvers, hnum, hattrs,
|
||||||
utype);
|
utype);
|
||||||
|
@ -400,8 +406,10 @@ _DtCm_check_entry_cms_attributes(
|
||||||
&realnum)) != CSA_SUCCESS)
|
&realnum)) != CSA_SUCCESS)
|
||||||
return (stat);
|
return (stat);
|
||||||
|
|
||||||
if (checkattrnum == B_TRUE && realnum == 0)
|
if (checkattrnum == B_TRUE && realnum == 0) {
|
||||||
|
free(hattrs);
|
||||||
return (CSA_E_INVALID_PARAMETER);
|
return (CSA_E_INVALID_PARAMETER);
|
||||||
|
}
|
||||||
|
|
||||||
stat = _DtCm_check_hashed_entry_attributes(fvers, hnum, hattrs,
|
stat = _DtCm_check_hashed_entry_attributes(fvers, hnum, hattrs,
|
||||||
utype);
|
utype);
|
||||||
|
@ -1184,10 +1192,12 @@ _DtCm_free_csa_access_list(CSA_access_list alist)
|
||||||
nptr = alist->next;
|
nptr = alist->next;
|
||||||
|
|
||||||
if (alist->user) {
|
if (alist->user) {
|
||||||
if (alist->user->user_name)
|
if (alist->user->user_name) {
|
||||||
free(alist->user->user_name);
|
free(alist->user->user_name);
|
||||||
if (alist->user->calendar_address);
|
}
|
||||||
|
if (alist->user->calendar_address) {
|
||||||
free(alist->user->calendar_address);
|
free(alist->user->calendar_address);
|
||||||
|
}
|
||||||
free(alist->user);
|
free(alist->user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -299,8 +299,10 @@ _DtCm_list_old_cal_attr_names(
|
||||||
return (CSA_E_INSUFFICIENT_MEMORY);
|
return (CSA_E_INSUFFICIENT_MEMORY);
|
||||||
|
|
||||||
/* find out whether we know the owner of the calendar */
|
/* find out whether we know the owner of the calendar */
|
||||||
if ((stat = _get_owner_from_old_cal(cal, buf)) != CSA_SUCCESS)
|
if ((stat = _get_owner_from_old_cal(cal, buf)) != CSA_SUCCESS) {
|
||||||
|
_DtCm_free(names);
|
||||||
return (stat);
|
return (stat);
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 1, j = 0; i <= _DtCM_DEFINED_CAL_ATTR_SIZE; i++) {
|
for (i = 1, j = 0; i <= _DtCM_DEFINED_CAL_ATTR_SIZE; i++) {
|
||||||
if (_CSA_cal_attr_info[i].fst_vers > 0 &&
|
if (_CSA_cal_attr_info[i].fst_vers > 0 &&
|
||||||
|
|
|
@ -85,8 +85,11 @@ _DtCmIsSameUser(char *user1, char *user2)
|
||||||
str1 = _DtCmGetPrefix(user1, '@');
|
str1 = _DtCmGetPrefix(user1, '@');
|
||||||
str2 = _DtCmGetPrefix(user2, '@');
|
str2 = _DtCmGetPrefix(user2, '@');
|
||||||
|
|
||||||
if (str1 == NULL || str2 == NULL)
|
if (str1 == NULL || str2 == NULL) {
|
||||||
|
free(str1);
|
||||||
|
free(str2);
|
||||||
return (B_FALSE);
|
return (B_FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
if (strcmp(str1, str2)) {
|
if (strcmp(str1, str2)) {
|
||||||
free(str1);
|
free(str1);
|
||||||
|
|
|
@ -926,8 +926,10 @@ DeriveDailyEvent(
|
||||||
/* Convert from list to array, sort */
|
/* Convert from list to array, sort */
|
||||||
dd->dd_time = (Time *)ConvertNumList(time_list, &(dd->dd_ntime));
|
dd->dd_time = (Time *)ConvertNumList(time_list, &(dd->dd_ntime));
|
||||||
|
|
||||||
if (interval < 1)
|
if (interval < 1) {
|
||||||
|
free(dd);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
re = (RepeatEvent *)calloc(1, sizeof(RepeatEvent));
|
re = (RepeatEvent *)calloc(1, sizeof(RepeatEvent));
|
||||||
|
|
||||||
|
@ -963,8 +965,10 @@ DeriveWeeklyEvent(
|
||||||
/* Convert from list to array, sort */
|
/* Convert from list to array, sort */
|
||||||
wd->wd_daytime = ConvertDayTime(dtl, &(wd->wd_ndaytime));
|
wd->wd_daytime = ConvertDayTime(dtl, &(wd->wd_ndaytime));
|
||||||
|
|
||||||
if (interval < 1)
|
if (interval < 1) {
|
||||||
|
free(wd);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
re = (RepeatEvent *)calloc(1, sizeof(RepeatEvent));
|
re = (RepeatEvent *)calloc(1, sizeof(RepeatEvent));
|
||||||
|
|
||||||
|
@ -1006,8 +1010,10 @@ DeriveMonthlyEvent(
|
||||||
(NumberList *)data_list, &(md->md_nitems));
|
(NumberList *)data_list, &(md->md_nitems));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (interval < 1)
|
if (interval < 1) {
|
||||||
|
free(md);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
re = (RepeatEvent *)calloc(1, sizeof(RepeatEvent));
|
re = (RepeatEvent *)calloc(1, sizeof(RepeatEvent));
|
||||||
|
|
||||||
|
@ -1044,8 +1050,10 @@ DeriveYearlyEvent(
|
||||||
/* Convert from list to array, sort */
|
/* Convert from list to array, sort */
|
||||||
yd->yd_items = ConvertNumList(nl, &(yd->yd_nitems));
|
yd->yd_items = ConvertNumList(nl, &(yd->yd_nitems));
|
||||||
|
|
||||||
if (interval < 1)
|
if (interval < 1) {
|
||||||
|
free(yd);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
re = (RepeatEvent *)calloc(1, sizeof(RepeatEvent));
|
re = (RepeatEvent *)calloc(1, sizeof(RepeatEvent));
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,8 @@
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
*************************************<+>*************************************/
|
*************************************<+>*************************************/
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -1161,7 +1163,10 @@ SetSavePath(
|
||||||
smGD.resourcePath[0] = 0;
|
smGD.resourcePath[0] = 0;
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
chmod(smGD.clientPath, 0755);
|
if(-1 == chmod(smGD.clientPath, 0755))
|
||||||
|
{
|
||||||
|
fprintf(stderr, "%s chmod error %s\n", smGD.clientPath, strerror(errno));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1293,7 +1298,10 @@ SetFontSavePath(char *langPtr)
|
||||||
smGD.fontPath[0] = 0;
|
smGD.fontPath[0] = 0;
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
chmod(smGD.fontPath, 0755);
|
if(-1 == chmod(smGD.fontPath, 0755))
|
||||||
|
{
|
||||||
|
fprintf(stderr, "%s chmod error %s\n", smGD.fontPath, strerror(errno));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -161,8 +161,8 @@ static Boolean CanReAuthenticate(char *name, uid_t uid, char *passwd,
|
||||||
{
|
{
|
||||||
Boolean fail = False;
|
Boolean fail = False;
|
||||||
|
|
||||||
*pwent = (name == NULL) ? getpwuid(uid) : getpwnam(name);
|
|
||||||
if (pwent)
|
if (pwent)
|
||||||
|
*pwent = (name == NULL) ? getpwuid(uid) : getpwnam(name);
|
||||||
*spent = getspnam((*pwent)->pw_name);
|
*spent = getspnam((*pwent)->pw_name);
|
||||||
|
|
||||||
#ifdef JET_AUTHDEBUG
|
#ifdef JET_AUTHDEBUG
|
||||||
|
|
|
@ -2013,6 +2013,7 @@ RestoreClients( void )
|
||||||
SM_FREE((char *) remoteBuf[i]);
|
SM_FREE((char *) remoteBuf[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
free(displayName);
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
hintPtr = NULL;
|
hintPtr = NULL;
|
||||||
|
|
|
@ -1620,12 +1620,12 @@ OutputResource( void )
|
||||||
langPtr = getenv("LANG");
|
langPtr = getenv("LANG");
|
||||||
if((langPtr != NULL) && (*langPtr != 0))
|
if((langPtr != NULL) && (*langPtr != 0))
|
||||||
{
|
{
|
||||||
sprintf(resSpec, "%s*%s: %s\n", SM_RESOURCE_NAME, SmNsessionLang,
|
snprintf(resSpec, resSize, "%s*%s: %s\n", SM_RESOURCE_NAME, SmNsessionLang,
|
||||||
langPtr);
|
langPtr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf(resSpec, "%s*%s: \n", SM_RESOURCE_NAME, SmNsessionLang);
|
snprintf(resSpec, resSize, "%s*%s: \n", SM_RESOURCE_NAME, SmNsessionLang);
|
||||||
}
|
}
|
||||||
|
|
||||||
fltYRes = ((float) DisplayHeight(smGD.display, 0) /
|
fltYRes = ((float) DisplayHeight(smGD.display, 0) /
|
||||||
|
|
|
@ -594,10 +594,12 @@ static
|
||||||
|
|
||||||
/* read the directory $HOME/.dt/backdrops */
|
/* read the directory $HOME/.dt/backdrops */
|
||||||
string = (char *)XtMalloc(strlen(style.home) + strlen("/.dt/backdrops") + 1);
|
string = (char *)XtMalloc(strlen(style.home) + strlen("/.dt/backdrops") + 1);
|
||||||
sprintf(string, "%s/.dt/backdrops", style.home);
|
|
||||||
ReadBitmapDirectory(string);
|
|
||||||
if (string != NULL)
|
if (string != NULL)
|
||||||
|
{
|
||||||
|
sprintf(string, "%s/.dt/backdrops", style.home);
|
||||||
|
ReadBitmapDirectory(string);
|
||||||
XtFree(string);
|
XtFree(string);
|
||||||
|
}
|
||||||
|
|
||||||
if (backdrops.tmpNumBitmaps == 0)
|
if (backdrops.tmpNumBitmaps == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -243,12 +243,13 @@ GetUserIMSelectionFile(
|
||||||
|
|
||||||
ret = GetUserFileName(env);
|
ret = GetUserFileName(env);
|
||||||
|
|
||||||
if (ret == NoError) {
|
if (ret == NoError) {
|
||||||
/* Look if this file is readable */
|
/* Look if this file is readable */
|
||||||
if ((fp = fopen(env->file_sel->fname, "r")) == NULL)
|
if ((fp = fopen(env->file_sel->fname, "r")) == NULL) {
|
||||||
env->file_sel->start_mode = -1;
|
env->file_sel->start_mode = -1;
|
||||||
return ErrNoSelectionFile;
|
return ErrNoSelectionFile;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
start_tag_line(env->file_sel->fname);
|
start_tag_line(env->file_sel->fname);
|
||||||
ret = ReadImSelectionFile(env->file_sel, fp);
|
ret = ReadImSelectionFile(env->file_sel, fp);
|
||||||
|
@ -314,31 +315,33 @@ ReadImSelectionFile(
|
||||||
|
|
||||||
imsname = hostname = NULL;
|
imsname = hostname = NULL;
|
||||||
|
|
||||||
while ((line_num = read_tag_line(fp, &lp, &valp)) > 0) {
|
while ((line_num = read_tag_line(fp, &lp, &valp)) > 0) {
|
||||||
if (!valp) {
|
if (!valp) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
if (lp[0] != STR_PREFIX_CHAR) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (strncmp(lp + 1, STR_SELECTMODE, 3) == 0) {
|
||||||
|
if (str_to_int(valp, &i) && i >= 0) {
|
||||||
|
select_mode = i;
|
||||||
|
}
|
||||||
|
} else if (strncmp(lp + 1, STR_IMSNAME, 4) == 0) {
|
||||||
|
vp = valp; cut_field(valp);
|
||||||
|
if (*vp) {
|
||||||
|
XtFree(imsname);
|
||||||
|
imsname = XtNewString(vp);
|
||||||
|
}
|
||||||
|
} else if (strncmp(lp + 1, STR_HOSTNAME, 4) == 0) {
|
||||||
|
vp = valp; cut_field(valp);
|
||||||
|
if (*vp) {
|
||||||
|
XtFree(hostname);
|
||||||
|
if (strcmp(vp, NAME_LOCAL)) {
|
||||||
|
hostname = XtNewString(vp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (lp[0] != STR_PREFIX_CHAR) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (strncmp(lp + 1, STR_SELECTMODE, 3) == 0) {
|
|
||||||
if (str_to_int(valp, &i) && i >= 0)
|
|
||||||
select_mode = i;
|
|
||||||
} else if (strncmp(lp + 1, STR_IMSNAME, 4) == 0) {
|
|
||||||
vp = valp; cut_field(valp);
|
|
||||||
if (*vp) {
|
|
||||||
XtFree(imsname);
|
|
||||||
imsname = XtNewString(vp);
|
|
||||||
}
|
|
||||||
} else if (strncmp(lp + 1, STR_HOSTNAME, 4) == 0) {
|
|
||||||
vp = valp; cut_field(valp);
|
|
||||||
if (*vp) {
|
|
||||||
XtFree(hostname);
|
|
||||||
if (strcmp(vp, NAME_LOCAL))
|
|
||||||
hostname = XtNewString(vp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fsel->im_name = imsname;
|
fsel->im_name = imsname;
|
||||||
fsel->hostname = hostname;
|
fsel->hostname = hostname;
|
||||||
|
@ -372,7 +375,7 @@ _DtI18nGetImList(
|
||||||
|
|
||||||
case HOST_LOCAL:
|
case HOST_LOCAL:
|
||||||
if (hostname && strcasecmp(hostname, "local") != 0)
|
if (hostname && strcasecmp(hostname, "local") != 0)
|
||||||
env->ims_sel->host_name = hostname;
|
env->ims_sel->host_name = hostname;
|
||||||
ret = GetImsList(env, env->user_env->localhostname);
|
ret = GetImsList(env, env->user_env->localhostname);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -631,6 +634,8 @@ _DtI18nWriteImSelectionFile(
|
||||||
|
|
||||||
/* Close the file */
|
/* Close the file */
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
|
return NoError;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in a new issue