From 432f500e59fb0b32f5c85c2cd4ed5758f0127c01 Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Tue, 24 May 2011 22:02:03 +0000 Subject: [PATCH] fix various incidents reported by CLANG Static analyzer: - unneeded Vars - possible uninitialized access --- webcit/calendar.c | 4 +-- webcit/crypto.c | 2 +- webcit/event.c | 10 +++++-- webcit/marchlist.c | 4 --- webcit/messages.c | 21 ++++++-------- webcit/netconf.c | 4 +-- webcit/notes.c | 5 ++-- webcit/pushemail.c | 20 +++---------- webcit/roomops.c | 4 +-- webcit/serv_func.c | 5 ++-- webcit/static.c | 11 ++----- webcit/subst.c | 71 +++++++--------------------------------------- webcit/subst.h | 1 - webcit/sysdep.c | 2 -- webcit/tasks.c | 3 -- webcit/useredit.c | 7 ++--- webcit/webcit.c | 3 -- webcit/webserver.c | 3 -- 18 files changed, 45 insertions(+), 135 deletions(-) diff --git a/webcit/calendar.c b/webcit/calendar.c index 7ddd35391..6bfbead40 100644 --- a/webcit/calendar.c +++ b/webcit/calendar.c @@ -654,7 +654,6 @@ void load_ical_object(long msgnum, int unread, StrBuf *Buf; StrBuf *Data = NULL; const char *bptr; - int Done = 0; char from[128] = ""; char mime_partnum[256]; char mime_filename[256]; @@ -676,10 +675,9 @@ void load_ical_object(long msgnum, int unread, FreeStrBuf (&Buf); return; } - while (!Done && (StrBuf_ServGetln(Buf)>=0)) { + while ((StrBuf_ServGetln(Buf)>=0)) { if ( (StrLength(Buf)==3) && !strcmp(ChrPtr(Buf), "000")) { - Done = 1; break; } bptr = ChrPtr(Buf); diff --git a/webcit/crypto.c b/webcit/crypto.c index 6618ac1bc..aa5c78b9f 100644 --- a/webcit/crypto.c +++ b/webcit/crypto.c @@ -60,7 +60,7 @@ void shutdown_ssl(void) */ void init_ssl(void) { - SSL_METHOD *ssl_method; + const SSL_METHOD *ssl_method; RSA *rsa=NULL; X509_REQ *req = NULL; X509 *cer = NULL; diff --git a/webcit/event.c b/webcit/event.c index 4b34b3126..3b6399913 100644 --- a/webcit/event.c +++ b/webcit/event.c @@ -46,7 +46,9 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, char buf[SIZ]; int organizer_is_me = 0; int i, j = 0; +#ifdef DEBUG_UID_CALENDAR int sequence = 0; +#endif char weekday_labels[7][32]; char month_labels[12][32]; long weekstart = 0; @@ -159,9 +161,11 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, /* Learn the sequence */ p = icalcomponent_get_first_property(vevent, ICAL_SEQUENCE_PROPERTY); +#ifdef DEBUG_UID_CALENDAR if (p != NULL) { sequence = icalproperty_get_sequence(p); } +#endif /* Begin output */ output_headers(1, 1, 2, 0, 0, 0); @@ -175,8 +179,10 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, wc_printf("
"); +#ifdef DEBUG_UID_CALENDAR /************************************************************ * Uncomment this to see the UID in calendar events for debugging + *************************************************************/ wc_printf("UID == "); p = icalcomponent_get_first_property(vevent, ICAL_UID_PROPERTY); if (p != NULL) { @@ -184,7 +190,7 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, } wc_printf("
\n"); wc_printf("SEQUENCE == %d
\n", sequence); - *************************************************************/ +#endif wc_printf("
\n"); wc_printf("\n", WC->nonce); @@ -979,7 +985,7 @@ void save_individual_event(icalcomponent *supplied_vevent, long msgnum, char *fr if (YESBSTR(buf)) recur.by_day[j++] = icalrecurrencetype_day_day_of_week(i+1); } - recur.by_day[j++] = ICAL_RECURRENCE_ARRAY_MAX; + recur.by_day[j] = ICAL_RECURRENCE_ARRAY_MAX; break; case ICAL_MONTHLY_RECURRENCE: diff --git a/webcit/marchlist.c b/webcit/marchlist.c index 63cd84cc4..fa0b8f553 100644 --- a/webcit/marchlist.c +++ b/webcit/marchlist.c @@ -58,8 +58,6 @@ void remove_march(const StrBuf *aaa) char *pop_march(int desired_floor) { static char TheRoom[128]; - int TheFloor = 0; - int TheOrder = 32767; int TheWeight = 0; int weight; struct march *mptr = NULL; @@ -81,8 +79,6 @@ char *pop_march(int desired_floor) if (weight > TheWeight) { TheWeight = weight; strcpy(TheRoom, mptr->march_name); - TheFloor = mptr->march_floor; - TheOrder = mptr->march_order; } } return (TheRoom); diff --git a/webcit/messages.c b/webcit/messages.c index 0bd29376e..fd6295d83 100644 --- a/webcit/messages.c +++ b/webcit/messages.c @@ -39,7 +39,6 @@ int load_message(message_summary *Msg, headereval *Hdr; void *vHdr; char buf[SIZ]; - int Done = 0; int state=0; Buf = NewStrBuf(); @@ -63,11 +62,10 @@ int load_message(message_summary *Msg, /* begin everythingamundo table */ HdrToken = NewStrBuf(); - while (!Done && StrBuf_ServGetln(Buf)>=0) { - if ( (StrLength(Buf)==3) && + while (StrBuf_ServGetln(Buf) >= 0) { + if ( (StrLength(Buf) ==3 ) && !strcmp(ChrPtr(Buf), "000")) { - Done = 1; if (state < 2) { if (Msg->MsgBody->Data == NULL) Msg->MsgBody->Data = NewStrBuf(); @@ -273,9 +271,10 @@ int read_message(StrBuf *Target, const char *tmpl, long tmpllen, long msgnum, co } -void +long HttpStatus(long CitadelStatus) { + /* TODO: this doesn't realy work currently, the HTTP status isn't printed to the browser! */ long httpstatus = 502; switch (MAJORCODE(CitadelStatus)) @@ -338,7 +337,7 @@ HttpStatus(long CitadelStatus) break; } - + return httpstatus; } /* @@ -347,7 +346,7 @@ HttpStatus(long CitadelStatus) */ void handle_one_message(void) { - long CitStatus; + long CitStatus = ERROR; int CopyMessage = 0; const StrBuf *Destination; void *vLine; @@ -718,7 +717,7 @@ void readloop(long oper, eCustomRoomRenderer ForceRenderer) void *vViewMsg; void *vMsg; message_summary *Msg; - char cmd[256] = ""; + char cmd[256]; int i, r; wcsession *WCC = WC; HashPos *at; @@ -728,6 +727,8 @@ void readloop(long oper, eCustomRoomRenderer ForceRenderer) SharedMessageStatus Stat; void *ViewSpecific; + cmd[0] = '\0'; + if (havebstr("is_summary") && (1 == (ibstr("is_summary")))) { WCC->CurRoom.view = VIEW_MAILBOX; } @@ -1454,13 +1455,9 @@ void move_msg(void) */ void confirm_move_msg(void) { - long msgid; char buf[SIZ]; char targ[SIZ]; - msgid = lbstr("msgid"); - - output_headers(1, 1, 2, 0, 0, 0); wc_printf("
\n"); wc_printf("

"); diff --git a/webcit/netconf.c b/webcit/netconf.c index cdd265a41..d08c42db3 100644 --- a/webcit/netconf.c +++ b/webcit/netconf.c @@ -97,8 +97,8 @@ HashList *load_netconf(StrBuf *Target, WCTemplputParams *TP) Hash = NewHash(1, NULL); Buf = NewStrBuf(); - while ((len = StrBuf_ServGetln(Buf), - strcmp(ChrPtr(Buf), "000"))) { + while ((len = StrBuf_ServGetln(Buf), (len >= 0) && + ((len != 3) || !strcmp(ChrPtr(Buf), "000")))) { Node = NewNode(Buf); if (Node == NULL) continue; diff --git a/webcit/notes.c b/webcit/notes.c index 835c61f2d..94176a312 100644 --- a/webcit/notes.c +++ b/webcit/notes.c @@ -28,7 +28,6 @@ struct vnote *vnote_new_from_msg(long msgnum,int unread) StrBuf *Buf; StrBuf *Data = NULL; const char *bptr; - int Done = 0; char uid_from_headers[256]; char mime_partnum[256]; char mime_filename[256]; @@ -43,6 +42,7 @@ struct vnote *vnote_new_from_msg(long msgnum,int unread) struct vnote *vnote_from_body = NULL; int vnote_inline = 0; /* 1 = MSG4 gave us a text/x-vnote top level */ + uid_from_headers[0] = '\0'; relevant_partnum[0] = '\0'; serv_printf("MSG4 %ld", msgnum); /* we need the mime headers */ Buf = NewStrBuf(); @@ -51,10 +51,9 @@ struct vnote *vnote_new_from_msg(long msgnum,int unread) FreeStrBuf (&Buf); return NULL; } - while ((StrBuf_ServGetln(Buf)>=0) && !Done) { + while ((StrBuf_ServGetln(Buf)>=0)) { if ( (StrLength(Buf)==3) && !strcmp(ChrPtr(Buf), "000")) { - Done = 1; break; } bptr = ChrPtr(Buf); diff --git a/webcit/pushemail.c b/webcit/pushemail.c index 2f59929eb..29a9ca98f 100644 --- a/webcit/pushemail.c +++ b/webcit/pushemail.c @@ -7,7 +7,6 @@ void display_pushemail(void) { folder Room; - int Done = 0; StrBuf *Buf; long vector[8] = {8, 0, 0, 1, 2, 3, 4, 5}; WCTemplputParams SubTP; @@ -28,11 +27,9 @@ void display_pushemail(void) if (GetServerStatus(Buf, NULL) == 8) { serv_puts("subj|__ Push email settings __"); serv_puts("000"); - while (!Done && - StrBuf_ServGetln(Buf) >= 0) { + while (StrBuf_ServGetln(Buf) >= 0) { if ( (StrLength(Buf)==3) && !strcmp(ChrPtr(Buf), "000")) { - Done = 1; break; } msgnum = StrTol(Buf); @@ -43,25 +40,19 @@ void display_pushemail(void) StrBuf_ServGetln(Buf); if (GetServerStatus(Buf, NULL) == 1) { int i =0; - Done = 0; - while (!Done && - StrBuf_ServGetln(Buf) >= 0) { + while (StrBuf_ServGetln(Buf) >= 0) { if (( (StrLength(Buf)==3) && !strcmp(ChrPtr(Buf), "000"))|| ((StrLength(Buf)==4) && !strcmp(ChrPtr(Buf), "text"))) { - Done = 1; break; } } if (!strcmp(ChrPtr(Buf), "text")) { - Done = 0; - while (!Done && - StrBuf_ServGetln(Buf) >= 0) { + while (StrBuf_ServGetln(Buf) >= 0) { if ( (StrLength(Buf)==3) && !strcmp(ChrPtr(Buf), "000")) { - Done = 1; break; } if (strncasecmp(ChrPtr(Buf), "none", 4) == 0) { @@ -96,7 +87,6 @@ void display_pushemail(void) void save_pushemail(void) { folder Room; - int Done = 0; StrBuf *Buf; char buf[SIZ]; int msgnum = 0; @@ -125,11 +115,9 @@ void save_pushemail(void) return; } - while (!Done && - StrBuf_ServGetln(Buf) >= 0) { + while (StrBuf_ServGetln(Buf) >= 0) { if ( (StrLength(Buf)==3) && !strcmp(ChrPtr(Buf), "000")) { - Done = 1; break; } msgnum = StrTol(Buf); diff --git a/webcit/roomops.c b/webcit/roomops.c index d2204f792..dc671632a 100644 --- a/webcit/roomops.c +++ b/webcit/roomops.c @@ -59,7 +59,6 @@ int is_view_allowed_as_default(int which_view) void load_floorlist(StrBuf *Buf) { int a; - int Done = 0; for (a = 0; a < MAX_FLOORS; ++a) floorlist[a][0] = 0; @@ -70,10 +69,9 @@ void load_floorlist(StrBuf *Buf) strcpy(floorlist[0], "Main Floor"); return; } - while (!Done && (StrBuf_ServGetln(Buf)>=0)) { + while (StrBuf_ServGetln(Buf) >= 0) { if ( (StrLength(Buf)==3) && !strcmp(ChrPtr(Buf), "000")) { - Done = 1; break; } extract_token(floorlist[StrBufExtract_int(Buf, 0, '|')], ChrPtr(Buf), 1, '|', sizeof floorlist[0]); diff --git a/webcit/serv_func.c b/webcit/serv_func.c index f4162a5a0..d6751f24a 100644 --- a/webcit/serv_func.c +++ b/webcit/serv_func.c @@ -518,7 +518,7 @@ void text_to_server_qp(char *ptr) output_len += 2; } buf[output_len++] = '='; - buf[output_len++] = 0; + buf[output_len] = '\0'; serv_puts((char *)buf); output_len = 0; } @@ -530,9 +530,8 @@ void text_to_server_qp(char *ptr) sprintf((char *)&buf[output_len-1], "=%02X", buf[output_len-1]); output_len += 2; } - buf[output_len++] = 0; + buf[output_len] = '\0'; serv_puts((char *)buf); - output_len = 0; } } diff --git a/webcit/static.c b/webcit/static.c index b5ea7965d..fe9007a32 100644 --- a/webcit/static.c +++ b/webcit/static.c @@ -38,7 +38,6 @@ void output_static(const char *what) int fd; struct stat statbuf; off_t bytes; - off_t count = 0; const char *content_type; int len; const char *Err; @@ -65,7 +64,6 @@ void output_static(const char *what) return; } - count = 0; bytes = statbuf.st_size; if (StrBufReadBLOB(WC->WBuf, &fd, 1, bytes, &Err) < 0) @@ -104,7 +102,6 @@ int LoadStaticDir(const char *DirName, HashList *DirList, const char *RelDir) struct dirent *filedir_entry; int d_type = 0; int d_namelen; - int d_without_ext; int istoplevel; filedir = opendir (DirName); @@ -125,7 +122,6 @@ int LoadStaticDir(const char *DirName, HashList *DirList, const char *RelDir) while ((readdir_r(filedir, d, &filedir_entry) == 0) && (filedir_entry != NULL)) { - char *PStart; #ifdef _DIRENT_HAVE_D_NAMELEN d_namelen = filedir_entry->d_namelen; d_type = filedir_entry->d_type; @@ -143,8 +139,6 @@ int LoadStaticDir(const char *DirName, HashList *DirList, const char *RelDir) d_namelen = strlen(filedir_entry->d_name); d_type = DT_UNKNOWN; #endif - d_without_ext = d_namelen; - if ((d_namelen > 1) && filedir_entry->d_name[d_namelen - 1] == '~') continue; /* Ignore backup files... */ @@ -188,7 +182,6 @@ int LoadStaticDir(const char *DirName, HashList *DirList, const char *RelDir) break; case DT_LNK: /* TODO: check whether its a file or a directory */ case DT_REG: - PStart = filedir_entry->d_name; FileName = NewStrBufDup(Dir); if (ChrPtr(FileName) [ StrLength(FileName) - 1] != '/') StrBufAppendBufPlain(FileName, "/", 1, 0); @@ -229,7 +222,7 @@ void output_flat_static(void) (vFile != NULL)) { File = (StrBuf*) vFile; - output_static(ChrPtr(vFile)); + output_static(ChrPtr(File)); } } @@ -245,7 +238,7 @@ void output_static_safe(HashList *DirList) (vFile != NULL)) { File = (StrBuf*) vFile; - output_static(ChrPtr(vFile)); + output_static(ChrPtr(File)); } else { lprintf(1, "output_static_safe() file %s not found. \n", diff --git a/webcit/subst.c b/webcit/subst.c index bfffef3f4..4e795d272 100644 --- a/webcit/subst.c +++ b/webcit/subst.c @@ -233,11 +233,16 @@ void LogTemplateError (StrBuf *Target, const char *Type, int ErrorPos, WCTemplpu Type, ChrPtr(Error)); */ - StrBufPrintf(Info, "%s [%s] %s; [%s]", - Type, - Err, - ChrPtr(Error), - ChrPtr(TP->Tokens->FlatToken)); + FlushStrBuf(Info); + StrBufAppendBufPlain(Info, Type, -1, 0); + StrBufAppendBufPlain(Info, HKEY(" ["), 0); + StrBufAppendBufPlain(Info, Err, -1, 0); + StrBufAppendBufPlain(Info, HKEY("] "), 0); + StrBufAppendBuf(Info, Error, 0); + StrBufAppendBufPlain(Info, HKEY("; ["), 0); + if (TP->Tokens != NULL) + StrBufAppendBuf(Info, TP->Tokens->FlatToken, 0); + StrBufAppendBufPlain(Info, HKEY("]"), 0); SerializeJson(WCC->WFBuf, WildFireException(HKEY(__FILE__), __LINE__, Info, 1), 1); } FreeStrBuf(&Info); @@ -418,9 +423,6 @@ void VarPrintEntry(const char *Key, void *vSubst, int odd) case WCS_STRING: lprintf(1, " -> %s\n", ChrPtr(ptr->wcs_value)); break; - case WCS_SERVCMD: - lprintf(1, " -> Server [%s]\n", ChrPtr(ptr->wcs_value)); - break; case WCS_FUNCTION: lprintf(1, " -> function at [%0xd]\n", ptr->wcs_function); break; @@ -452,7 +454,6 @@ int NeedNewBuf(int type) { switch(type) { case WCS_STRING: - case WCS_SERVCMD: case WCS_STRBUF: return 1; case WCS_FUNCTION: @@ -468,7 +469,6 @@ void FlushPayload(wcsubst *ptr, int reusestrbuf, int type) int NeedNew = NeedNewBuf(type); switch(ptr->wcs_type) { case WCS_STRING: - case WCS_SERVCMD: case WCS_STRBUF: if (reusestrbuf && NeedNew) { FlushStrBuf(ptr->wcs_value); @@ -527,9 +527,6 @@ wcsubst *NewSubstVar(const char *keyname, int keylen, int type) switch(ptr->wcs_type) { case WCS_STRING: - case WCS_SERVCMD: - ptr->wcs_value = NewStrBuf(); - break; case WCS_STRBUF: case WCS_FUNCTION: case WCS_STRBUF_REF: @@ -733,33 +730,6 @@ void SVPUTBuf(const char *keyname, int keylen, const StrBuf *Buf, int ref) ptr->wcs_value = (StrBuf*)Buf; } -/** - * \brief back end for print_value_of() ... does a server command - * \param servcmd server command to execute on the citadel server - */ -void pvo_do_cmd(StrBuf *Target, StrBuf *servcmd) { - char buf[SIZ]; - int len; - - serv_puts(ChrPtr(servcmd)); - len = serv_getln(buf, sizeof buf); - - switch(buf[0]) { - case '2': - case '3': - case '5': - StrBufAppendPrintf(Target, "%s\n", &buf[4]); - break; - case '1': - _fmout(Target, "CENTER"); - break; - case '4': - StrBufAppendPrintf(Target, "%s\n", &buf[4]); - serv_puts("000"); - break; - } -} - int HaveTemplateTokenString(StrBuf *Target, WCTemplputParams *TP, int N, @@ -975,9 +945,6 @@ void print_value_of(StrBuf *Target, WCTemplputParams *TP) case WCS_STRING: StrBufAppendBuf(Target, ptr->wcs_value, 0); break; - case WCS_SERVCMD: - pvo_do_cmd(Target, ptr->wcs_value); - break; case WCS_FUNCTION: (*ptr->wcs_function) (Target, TP); break; @@ -1021,9 +988,6 @@ int CompareSubstToToken(TemplateParam *ParamToCompare, TemplateParam *ParamToLoo else return ParamToCompare->lvalue == StrTol(ptr->wcs_value); break; - case WCS_SERVCMD: - return 1; - break; case WCS_FUNCTION: return 1; case WCS_LONG: @@ -1055,9 +1019,6 @@ int CompareSubstToStrBuf(StrBuf *Compare, TemplateParam *ParamToLookup) case WCS_STRBUF_REF: return ((StrLength(Compare) == StrLength(ptr->wcs_value)) && (strcmp(ChrPtr(Compare), ChrPtr(ptr->wcs_value)) == 0)); - case WCS_SERVCMD: - return 1; - break; case WCS_FUNCTION: return 1; case WCS_LONG: @@ -1081,7 +1042,6 @@ void StrBufAppendTemplate(StrBuf *Target, WCTemplputParams *TP, const StrBuf *Source, int FormatTypeIndex) { - wcsession *WCC; char EscapeAs = ' '; if ((FormatTypeIndex < TP->Tokens->nParameters) && @@ -1093,7 +1053,6 @@ void StrBufAppendTemplate(StrBuf *Target, switch(EscapeAs) { case 'H': - WCC = WC; StrEscAppend(Target, Source, NULL, 0, 2); break; case 'X': @@ -1581,7 +1540,6 @@ void *load_template(WCTemplate *NewTemplate) struct stat statbuf; const char *pS, *pE, *pch, *Err; long Line; - int pos; fd = open(ChrPtr(NewTemplate->FileName), O_RDONLY); if (fd <= 0) { @@ -1617,7 +1575,6 @@ void *load_template(WCTemplate *NewTemplate) int InDoubleQuotes = 0; /** Find one */ - pos = (-1); for (; pch < pE; pch ++) { if ((*pch=='<')&&(*(pch + 1)=='?') && !((pch == pS) && /* we must ommit a d_namelen; d_type = filedir_entry->d_type; @@ -1779,7 +1735,6 @@ int LoadTemplateDir(const StrBuf *DirName, HashList *wireless, HashList *big, co if (d_without_ext > 2) IsMobile = (filedir_entry->d_name[d_without_ext - 1] == 'm') && (filedir_entry->d_name[d_without_ext - 2] == '.'); - PStart = filedir_entry->d_name; StrBufPrintf(FileName, "%s/%s", ChrPtr(DirName), filedir_entry->d_name); MinorPtr = strchr(filedir_entry->d_name, '.'); if (MinorPtr != NULL) @@ -2372,9 +2327,6 @@ int ConditionalVar(StrBuf *Target, WCTemplputParams *TP) switch(subst->wcs_type) { case WCS_FUNCTION: return (subst->wcs_function!=NULL); - case WCS_SERVCMD: - lprintf(1, " -> Server [%s]\n", subst->wcs_value);/* TODO */ - return 1; case WCS_STRING: case WCS_STRBUF: case WCS_STRBUF_REF: @@ -2700,7 +2652,6 @@ CompareFunc RetrieveSort(WCTemplputParams *TP, const char *OtherPrefix, long OtherPrefixLen, const char *Default, long ldefault, long DefaultDirection) { - int isdefault = 0; const StrBuf *BSort = NULL; SortStruct *SortBy; void *vSortBy; @@ -2734,7 +2685,6 @@ CompareFunc RetrieveSort(WCTemplputParams *TP, if (!GetHash(SortHash, SKEY(BSort), &vSortBy) || (vSortBy == NULL)) { - isdefault = 1; if (!GetHash(SortHash, Default, ldefault, &vSortBy) || (vSortBy == NULL)) { LogTemplateError( @@ -2759,6 +2709,7 @@ CompareFunc RetrieveSort(WCTemplputParams *TP, SortOrder = StrTol(Buf); } else { + /* TODO: this is never used??? */ BSort = get_X_PREFS(HKEY("SortOrder"), OtherPrefix, OtherPrefixLen); } diff --git a/webcit/subst.h b/webcit/subst.h index 970aa0368..2899d05c9 100644 --- a/webcit/subst.h +++ b/webcit/subst.h @@ -26,7 +26,6 @@ extern HashList *LocalTemplateCache; enum { WCS_STRING, /* its a string */ WCS_FUNCTION, /* its a function callback */ - WCS_SERVCMD, /* its a command to send to the citadel server */ WCS_STRBUF, /* its a strbuf we own */ WCS_STRBUF_REF, /* its a strbuf we mustn't free */ WCS_LONG /* its an integer */ diff --git a/webcit/sysdep.c b/webcit/sysdep.c index b3470a042..7c0acca76 100644 --- a/webcit/sysdep.c +++ b/webcit/sysdep.c @@ -386,8 +386,6 @@ void start_daemon(char *pid_file) waitpid(current_child, &status, 0); } - do_restart = 0; - /* Did the main process exit with an actual exit code? */ if (WIFEXITED(status)) { diff --git a/webcit/tasks.c b/webcit/tasks.c index 42ae949ba..25a638120 100644 --- a/webcit/tasks.c +++ b/webcit/tasks.c @@ -181,12 +181,9 @@ void display_edit_individual_task(icalcomponent *supplied_vtodo, long msgnum, ch icalcomponent *vtodo; icalproperty *p; struct icaltimetype IcalTime; - time_t now; int created_new_vtodo = 0; icalproperty_status todoStatus; - now = time(NULL); - if (supplied_vtodo != NULL) { vtodo = supplied_vtodo; diff --git a/webcit/useredit.c b/webcit/useredit.c index 0bfc7ff37..d4a5afbe2 100644 --- a/webcit/useredit.c +++ b/webcit/useredit.c @@ -270,13 +270,12 @@ HashList *iterate_load_userlist(StrBuf *Target, WCTemplputParams *TP) if (GetServerStatus(Buf, NULL) == 1) { Hash = NewHash(1, NULL); - while (!Done) { + while (1) { len = StrBuf_ServGetln(Buf); - if ((len <0) || + if ((len < 0) || ((len == 3) && !strcmp(ChrPtr(Buf), "000"))) { - Done = 1; break; } ul = NewUserListEntry(Buf); @@ -419,7 +418,6 @@ long locate_user_vcard_in_this_room(message_summary **VCMsg, wc_mime_attachment void *vMsg; message_summary *Msg; wc_mime_attachment *Att; - int Done; StrBuf *Buf; long vcard_msgnum = (-1L); int already_tried_creating_one = 0; @@ -434,7 +432,6 @@ TRYAGAIN: Stat.maxload = 10000; Stat.lowest_found = (-1); Stat.highest_found = (-1); - Done = 0; /* Search for the user's vCard */ if (load_msg_ptrs("MSGS ALL||||1", &Stat, NULL) > 0) { at = GetNewHashPos(WCC->summ, 0); diff --git a/webcit/webcit.c b/webcit/webcit.c index 9de1ad242..75db9ec8b 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -595,7 +595,6 @@ int Conditional_REST_DEPTH(StrBuf *Target, WCTemplputParams *TP) */ void session_loop(void) { - int Flags = 0; int xhttp; StrBuf *Buf; @@ -610,8 +609,6 @@ void session_loop(void) WCC->upload = NULL; WCC->is_mobile = 0; WCC->Hdr->nWildfireHeaders = 0; - if (WCC->Hdr->HR.Handler != NULL) - Flags = WCC->Hdr->HR.Handler->Flags; /* so we can temporarily add our own... */ if (WCC->Hdr->HR.ContentLength > 0) { if (ReadPostData() < 0) { diff --git a/webcit/webserver.c b/webcit/webserver.c index 3546878db..180e0e2b5 100644 --- a/webcit/webserver.c +++ b/webcit/webserver.c @@ -24,7 +24,6 @@ extern int verbosity; /* Logging level */ extern char static_icon_dir[PATH_MAX]; /* where should we find our mime icons */ int is_https = 0; /* Nonzero if I am an HTTPS service */ int follow_xff = 0; /* Follow X-Forwarded-For: header */ -int home_specified = 0; /* did the user specify a homedir? */ int DisableGzip = 0; extern pthread_mutex_t SessionListMutex; extern pthread_key_t MyConKey; @@ -81,7 +80,6 @@ int main(int argc, char **argv) char ip_addr[256]="0.0.0.0"; int relh=0; int home=0; - int home_specified=0; char relhome[PATH_MAX]=""; char webcitdir[PATH_MAX] = DATADIR; char *pidfile = NULL; @@ -131,7 +129,6 @@ int main(int argc, char **argv) safestrncpy(relhome, relhome, sizeof relhome); } /* free(hdir); TODO: SHOULD WE DO THIS? */ - home_specified = 1; home=1; break; case 'd': -- 2.39.2