From e26a8dee20d1726b4995821f717f867f50fc5659 Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Wed, 7 Sep 2011 14:59:21 +0000 Subject: [PATCH] Fix warnings all over citserver; handle function replies; remove unused code. --- citadel/config.c | 3 ++ citadel/context.c | 2 - citadel/file_ops.c | 10 +++++ citadel/locate_host.c | 4 -- citadel/modules/crypto/serv_crypto.c | 5 +-- citadel/modules/imap/imap_fetch.c | 2 - citadel/modules/imap/imap_list.c | 2 - citadel/modules/imap/imap_misc.c | 2 - citadel/modules/imap/serv_imap.c | 13 +------ .../modules/managesieve/serv_managesieve.c | 5 +-- citadel/modules/migrate/serv_migrate.c | 2 - citadel/modules/network/serv_network.c | 6 +-- citadel/modules/openid/serv_openid_rp.c | 6 +-- citadel/modules/smtp/serv_smtp.c | 2 - citadel/modules/vcard/serv_vcard.c | 6 ++- citadel/modules/wiki/serv_wiki.c | 2 +- citadel/modules/xmpp/xmpp_messages.c | 3 +- citadel/msgbase.c | 19 +++++++--- citadel/user_ops.c | 27 ++++++++++++-- citadel/user_ops.h | 2 +- citadel/utillib/citadel_dirs.c | 37 +++++++++++++------ 21 files changed, 93 insertions(+), 67 deletions(-) diff --git a/citadel/config.c b/citadel/config.c index 6817e27fe..bc9a4128e 100644 --- a/citadel/config.c +++ b/citadel/config.c @@ -179,6 +179,9 @@ void put_config(void) perror(file_citadel_config); else { rv = fwrite((char *) &config, sizeof(struct config), 1, cfp); + if (rv == -1) + syslog(LOG_EMERG, "Failed to write: %s [%s]\n", + file_citadel_config, strerror(errno)); fclose(cfp); } } diff --git a/citadel/context.c b/citadel/context.c index cf8309e01..0b433502e 100644 --- a/citadel/context.c +++ b/citadel/context.c @@ -276,12 +276,10 @@ void terminate_idle_sessions(void) { CitContext *ccptr; time_t now; - int session_to_kill; int killed = 0; int longrunners = 0; now = time(NULL); - session_to_kill = 0; begin_critical_section(S_SESSION_TABLE); for (ccptr = ContextList; ccptr != NULL; ccptr = ccptr->next) { if ( diff --git a/citadel/file_ops.c b/citadel/file_ops.c index bb5e985a6..3bb6da1d8 100644 --- a/citadel/file_ops.c +++ b/citadel/file_ops.c @@ -373,6 +373,12 @@ void cmd_oimg(char *cmdbuf) return; } rv = fread(&MimeTestBuf[0], 1, 32, CC->download_fp); + if (rv == -1) { + cprintf("%d Cannot access %s: %s\n", + ERROR + FILE_NOT_FOUND, pathname, strerror(errno)); + return; + } + rewind (CC->download_fp); OpenCmdResult(pathname, GuessMimeType(&MimeTestBuf[0], 32)); } @@ -706,6 +712,10 @@ void cmd_writ(char *cmdbuf) buf = malloc(bytes + 1); client_read(buf, bytes); rv = fwrite(buf, bytes, 1, CC->upload_fp); + if (rv == -1) { + syslog(LOG_EMERG, "Couldn't write: %s\n", + strerror(errno)); + } free(buf); } diff --git a/citadel/locate_host.c b/citadel/locate_host.c index c3a196369..2a7568b23 100644 --- a/citadel/locate_host.c +++ b/citadel/locate_host.c @@ -243,13 +243,11 @@ int rbl_check(char *message_to_spammer) int num_rbl; char rbl_domains[SIZ]; char txt_answer[1024]; - int ip_version = 4; strcpy(message_to_spammer, "ok"); if ((strchr(CC->cs_addr, '.')) && (!strchr(CC->cs_addr, ':'))) { int a1, a2, a3, a4; - ip_version = 4; sscanf(CC->cs_addr, "%d.%d.%d.%d", &a1, &a2, &a3, &a4); snprintf(tbuf, sizeof tbuf, "%d.%d.%d.%d.", a4, a3, a2, a1); @@ -261,8 +259,6 @@ int rbl_check(char *message_to_spammer) char workbuf[sizeof tbuf]; char *ptr; - ip_version = 6; - /* tedious code to expand and reverse an IPv6 address */ safestrncpy(tbuf, CC->cs_addr, sizeof tbuf); num_colons = haschar(tbuf, ':'); diff --git a/citadel/modules/crypto/serv_crypto.c b/citadel/modules/crypto/serv_crypto.c index 6afeee84b..5fa965e5d 100644 --- a/citadel/modules/crypto/serv_crypto.c +++ b/citadel/modules/crypto/serv_crypto.c @@ -79,7 +79,7 @@ void destruct_ssl(void) void init_ssl(void) { - SSL_METHOD *ssl_method; + const SSL_METHOD *ssl_method; DH *dh; RSA *rsa=NULL; X509_REQ *req = NULL; @@ -471,11 +471,10 @@ int client_readline_sslbuffer(StrBuf *Line, StrBuf *IOBuf, const char **Pos, int CitContext *CCC = CC; const char *pos = NULL; const char *pLF; - int len, rlen, retlen; + int len, rlen; int nSuccessLess = 0; const char *pch = NULL; - retlen = 0; if ((Line == NULL) || (Pos == NULL) || (IOBuf == NULL)) diff --git a/citadel/modules/imap/imap_fetch.c b/citadel/modules/imap/imap_fetch.c index 862f58757..5fedc283a 100644 --- a/citadel/modules/imap/imap_fetch.c +++ b/citadel/modules/imap/imap_fetch.c @@ -1258,7 +1258,6 @@ int imap_extract_data_items(citimap_command *Cmd) int nArgs; int nest = 0; const char *pch, *end; - long initial_len; /* Convert all whitespace to ordinary space characters. */ pch = ChrPtr(Cmd->CmdBuf); @@ -1293,7 +1292,6 @@ int imap_extract_data_items(citimap_command *Cmd) */ nArgs = StrLength(Cmd->CmdBuf) / 10 + 10; nArgs = CmdAdjust(Cmd, nArgs, 0); - initial_len = StrLength(Cmd->CmdBuf); Cmd->num_parms = 0; Cmd->Params[Cmd->num_parms].Key = pch = ChrPtr(Cmd->CmdBuf); end = Cmd->Params[Cmd->num_parms].Key + StrLength(Cmd->CmdBuf); diff --git a/citadel/modules/imap/imap_list.c b/citadel/modules/imap/imap_list.c index f66f12133..6dbbe6ebb 100644 --- a/citadel/modules/imap/imap_list.c +++ b/citadel/modules/imap/imap_list.c @@ -195,7 +195,6 @@ void imap_list(int num_parms, ConstStr *Params) int selection_left = (-1); int selection_right = (-1); int return_left = (-1); - int return_right = (-1); int root_pos = 2; int patterns_left = 3; int patterns_right = 3; @@ -388,7 +387,6 @@ void imap_list(int num_parms, ConstStr *Params) } if (paren_nest == 0) { - return_right = i; /* found end of patterns */ i = num_parms + 1; /* break out of the loop */ } } diff --git a/citadel/modules/imap/imap_misc.c b/citadel/modules/imap/imap_misc.c index 3392c71bc..3ccd46367 100644 --- a/citadel/modules/imap/imap_misc.c +++ b/citadel/modules/imap/imap_misc.c @@ -281,7 +281,6 @@ void imap_do_append_flags(long new_msgnum, char *new_message_flags) { */ void imap_append(int num_parms, ConstStr *Params) { long literal_length; - long bytes_transferred; struct CtdlMessage *msg = NULL; long new_msgnum = (-1L); int ret = 0; @@ -340,7 +339,6 @@ void imap_append(int num_parms, ConstStr *Params) { IUnbuffer (); - bytes_transferred = 0; client_read_blob(Imap->TransmittedMessage, literal_length, config.c_sleeping); if ((ret < 0) || (StrLength(Imap->TransmittedMessage) < literal_length)) { diff --git a/citadel/modules/imap/serv_imap.c b/citadel/modules/imap/serv_imap.c index e9f566375..eab1e8571 100644 --- a/citadel/modules/imap/serv_imap.c +++ b/citadel/modules/imap/serv_imap.c @@ -821,8 +821,6 @@ void imap_select(int num_parms, ConstStr *Params) int ra = 0; struct ctdlroom QRscratch; int msgs, new; - int floornum; - int roomflags; int i; /* Convert the supplied folder name to a roomname */ @@ -832,8 +830,6 @@ void imap_select(int num_parms, ConstStr *Params) Imap->selected = 0; return; } - floornum = (i & 0x00ff); - roomflags = (i & 0xff00); /* First try a regular match */ c = CtdlGetRoom(&QRscratch, towhere); @@ -1385,7 +1381,7 @@ void imap_rename(int num_parms, ConstStr *Params) { char old_room[ROOMNAMELEN]; char new_room[ROOMNAMELEN]; - int oldr, newr; + int newr; int new_floor; int r; struct irl *irl = NULL; /* the list */ @@ -1398,7 +1394,7 @@ void imap_rename(int num_parms, ConstStr *Params) return; } - oldr = imap_roomname(old_room, sizeof old_room, Params[2].Key); + imap_roomname(old_room, sizeof old_room, Params[2].Key); newr = imap_roomname(new_room, sizeof new_room, Params[3].Key); new_floor = (newr & 0xFF); @@ -1477,7 +1473,6 @@ void imap_command_loop(void) { struct timeval tv1, tv2; suseconds_t total_time = 0; - int untagged_ok = 1; citimap *Imap; const char *pchs, *pche; const imap_handler_hook *h; @@ -1554,10 +1549,6 @@ void imap_command_loop(void) * If the command just submitted does not contain a literal, we * might think about delivering some untagged stuff... */ - if (*(ChrPtr(Imap->Cmd.CmdBuf) + StrLength(Imap->Cmd.CmdBuf) - 1) - == '}') { - untagged_ok = 0; - } /* Grab the tag, command, and parameters. */ imap_parameterize(&Imap->Cmd); diff --git a/citadel/modules/managesieve/serv_managesieve.c b/citadel/modules/managesieve/serv_managesieve.c index b0e5f7de9..289bc5784 100644 --- a/citadel/modules/managesieve/serv_managesieve.c +++ b/citadel/modules/managesieve/serv_managesieve.c @@ -279,7 +279,6 @@ void cmd_mgsve_auth(int num_parms, char **parms, struct sdm_userdata *u) /* todo, check length*/ { char auth[SIZ]; - int retval; char *message; char *username; @@ -289,10 +288,10 @@ void cmd_mgsve_auth(int num_parms, char **parms, struct sdm_userdata *u) message = ReadString(GetSizeToken(parms[2]), parms[0]); if (message != NULL) {/**< do we have tokenized login? */ - retval = CtdlDecodeBase64(auth, MGSVE->transmitted_message, SIZ); + CtdlDecodeBase64(auth, MGSVE->transmitted_message, SIZ); } else - retval = CtdlDecodeBase64(auth, parms[2], SIZ); + CtdlDecodeBase64(auth, parms[2], SIZ); username = auth; if ((*username == '\0') && (*(username + 1) != '\0')) username ++; diff --git a/citadel/modules/migrate/serv_migrate.c b/citadel/modules/migrate/serv_migrate.c index 5c0a2e27d..d1d6d04b9 100644 --- a/citadel/modules/migrate/serv_migrate.c +++ b/citadel/modules/migrate/serv_migrate.c @@ -394,8 +394,6 @@ void migr_export_messages(void) { void migr_do_export(void) { - struct config *buf; - buf = &config; CitContext *Ctx; Ctx = CC; diff --git a/citadel/modules/network/serv_network.c b/citadel/modules/network/serv_network.c index 7506a1abf..7955f5a2e 100644 --- a/citadel/modules/network/serv_network.c +++ b/citadel/modules/network/serv_network.c @@ -494,7 +494,6 @@ void network_deliver_digest(SpoolControl *sc) { long msglen; char *recps = NULL; size_t recps_len = SIZ; - size_t siz; struct recptypes *valid; namelist *nptr; char bounce_to[256]; @@ -541,7 +540,7 @@ void network_deliver_digest(SpoolControl *sc) { msg->cm_fields['M'] = malloc(msglen + 1); fseek(sc->digestfp, 0L, SEEK_SET); - siz = fread(msg->cm_fields['M'], (size_t)msglen, 1, sc->digestfp); + fread(msg->cm_fields['M'], (size_t)msglen, 1, sc->digestfp); msg->cm_fields['M'][msglen] = '\0'; fclose(sc->digestfp); @@ -653,7 +652,6 @@ void network_spool_msg(long msgnum, void *userdata) { SpoolControl *sc; int i; char *newpath = NULL; - size_t instr_len = SIZ; struct CtdlMessage *msg = NULL; namelist *nptr; maplist *mptr; @@ -672,7 +670,6 @@ void network_spool_msg(long msgnum, void *userdata) { /* * Process mailing list recipients */ - instr_len = SIZ; if (sc->listrecps != NULL) { /* Fetch the message. We're going to need to modify it * in order to insert the [list name] in it, etc. @@ -810,7 +807,6 @@ void network_spool_msg(long msgnum, void *userdata) { /* * Process client-side list participations for this room */ - instr_len = SIZ; if (sc->participates != NULL) { msg = CtdlFetchMessage(msgnum, 1); if (msg != NULL) { diff --git a/citadel/modules/openid/serv_openid_rp.c b/citadel/modules/openid/serv_openid_rp.c index 080916282..c82a6c286 100644 --- a/citadel/modules/openid/serv_openid_rp.c +++ b/citadel/modules/openid/serv_openid_rp.c @@ -485,7 +485,7 @@ int login_via_openid(StrBuf *claimed_id) */ void extract_link(StrBuf *target_buf, const char *rel, long repllen, StrBuf *source_buf) { - int len, i; + int i; const char *ptr; const char *href_start = NULL; const char *href_end = NULL; @@ -508,8 +508,6 @@ void extract_link(StrBuf *target_buf, const char *rel, long repllen, StrBuf *sou if (link_tag_end == NULL) break; for (i=0; i < 1; i++ ){ - len = link_tag_end - link_tag_start; - rel_start = cbmstrcasestr(link_tag_start, "rel="); if ((rel_start == NULL) || (rel_start > link_tag_end)) @@ -744,7 +742,7 @@ void cmd_oidf(char *argbuf) { if (len < 0) len = sizeof(thiskey) - 1; extract_token(thisdata, buf, 1, '|', sizeof thisdata); - syslog(LOG_DEBUG, "%s: [%d] %s\n", thiskey, strlen(thisdata), thisdata); + syslog(LOG_DEBUG, "%s: ["SIZE_T_FMT"] %s\n", thiskey, strlen(thisdata), thisdata); Put(keys, thiskey, len, strdup(thisdata), NULL); } diff --git a/citadel/modules/smtp/serv_smtp.c b/citadel/modules/smtp/serv_smtp.c index 9e1366bc9..b28ca2ef3 100644 --- a/citadel/modules/smtp/serv_smtp.c +++ b/citadel/modules/smtp/serv_smtp.c @@ -181,10 +181,8 @@ void smtp_msa_greeting(void) { * LMTP is like SMTP but with some extra bonus footage added. */ void lmtp_greeting(void) { - citsmtp *sSMTP; smtp_greeting(0); - sSMTP = SMTP; SMTP->is_lmtp = 1; } diff --git a/citadel/modules/vcard/serv_vcard.c b/citadel/modules/vcard/serv_vcard.c index cc0ad99fb..8efae6578 100644 --- a/citadel/modules/vcard/serv_vcard.c +++ b/citadel/modules/vcard/serv_vcard.c @@ -1315,7 +1315,6 @@ void strip_addresses_already_have(long msgnum, void *userdata) { */ void store_this_ha(struct addresses_to_be_filed *aptr) { struct CtdlMessage *vmsg = NULL; - long vmsgnum = (-1L); char *ser = NULL; struct vCard *v = NULL; char recipient[256]; @@ -1352,7 +1351,7 @@ void store_this_ha(struct addresses_to_be_filed *aptr) { vcard_free(v); syslog(LOG_DEBUG, "Adding contact: %s\n", recipient); - vmsgnum = CtdlSubmitMsg(vmsg, NULL, aptr->roomname, QP_EADDR); + CtdlSubmitMsg(vmsg, NULL, aptr->roomname, QP_EADDR); CtdlFreeMessage(vmsg); } } @@ -1459,6 +1458,9 @@ CTDL_MODULE_INIT(vcard) fp = fopen(filename, "a"); if (fp != NULL) fclose(fp); rv = chown(filename, CTDLUID, (-1)); + if (rv == -1) + syslog(LOG_EMERG, "Failed to adjust ownership of: %s [%s]\n", + filename, strerror(errno)); } /* for postfix tcpdict */ diff --git a/citadel/modules/wiki/serv_wiki.c b/citadel/modules/wiki/serv_wiki.c index f2b54c892..f18bb4a4a 100644 --- a/citadel/modules/wiki/serv_wiki.c +++ b/citadel/modules/wiki/serv_wiki.c @@ -193,7 +193,7 @@ int wiki_upload_beforesave(struct CtdlMessage *msg) { fclose(fp); } - syslog(LOG_DEBUG, "diff length is %d bytes", diffbuf_len); + syslog(LOG_DEBUG, "diff length is "SIZE_T_FMT" bytes", diffbuf_len); unlink(diff_old_filename); unlink(diff_new_filename); diff --git a/citadel/modules/xmpp/xmpp_messages.c b/citadel/modules/xmpp/xmpp_messages.c index 0deb0199a..5265fc188 100644 --- a/citadel/modules/xmpp/xmpp_messages.c +++ b/citadel/modules/xmpp/xmpp_messages.c @@ -94,7 +94,6 @@ void xmpp_output_incoming_messages(void) { */ void xmpp_send_message(char *message_to, char *message_body) { char *recp = NULL; - int message_sent = 0; struct CitContext *cptr; if (message_body == NULL) return; @@ -112,7 +111,7 @@ void xmpp_send_message(char *message_to, char *message_body) { } if (recp) { - message_sent = PerformXmsgHooks(CC->user.fullname, CC->cs_inet_email, recp, message_body); + PerformXmsgHooks(CC->user.fullname, CC->cs_inet_email, recp, message_body); } free(XMPP->message_body); diff --git a/citadel/msgbase.c b/citadel/msgbase.c index a02f7cd24..7eb321905 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -1106,6 +1106,10 @@ void mime_download(char *name, char *filename, char *partnum, char *disp, return; rv = fwrite(content, length, 1, CC->download_fp); + if (rv == -1) { + syslog(LOG_EMERG, "mime_download(): Couldn't write: %s\n", + strerror(errno)); + } fflush(CC->download_fp); rewind(CC->download_fp); @@ -2068,7 +2072,6 @@ void Dump_RFC822HeadersBody( int outlen = 0; int nllen = strlen(nl); char *mptr; - int rc; mptr = TheMessage->cm_fields['M']; @@ -2128,7 +2131,7 @@ void Dump_RFC822HeadersBody( } } if (outlen > 0) { - rc = client_write(outbuf, outlen); + client_write(outbuf, outlen); outlen = 0; } } @@ -2934,7 +2937,6 @@ void serialize_message(struct ser_ret *ret, /* return values */ void dump_message(struct CtdlMessage *msg, /* unserialized msg */ long Siz) /* how many chars ? */ { - size_t wlen; int i; static char *forder = FORDER; char *buf; @@ -2949,8 +2951,6 @@ void dump_message(struct CtdlMessage *msg, /* unserialized msg */ buf = (char*) malloc (Siz + 1); - wlen = 3; - for (i=0; i<26; ++i) if (msg->cm_fields[(int)forder[i]] != NULL) { snprintf (buf, Siz, " msg[%c] = %s ...\n", (char) forder[i], msg->cm_fields[(int)forder[i]]); @@ -3308,6 +3308,10 @@ long CtdlSubmitMsg(struct CtdlMessage *msg, /* message to save */ network_fp = fopen(submit_filename, "wb+"); if (network_fp != NULL) { rv = fwrite(smr.ser, smr.len, 1, network_fp); + if (rv == -1) { + syslog(LOG_EMERG, "CtdlSubmitMsg(): Couldn't write network spool file: %s\n", + strerror(errno)); + } fclose(network_fp); } free(smr.ser); @@ -4968,6 +4972,11 @@ void AdjRefCount(long msgnum, int incr) new_arcq.arcq_msgnum = msgnum; new_arcq.arcq_delta = incr; rv = fwrite(&new_arcq, sizeof(struct arcq), 1, arcfp); + if (rv == -1) { + syslog(LOG_EMERG, "Couldn't write Refcount Queue File %s: %s\n", + file_arcq, + strerror(errno)); + } fflush(arcfp); return; diff --git a/citadel/user_ops.c b/citadel/user_ops.c index d7f88ad4d..17aa4e771 100644 --- a/citadel/user_ops.c +++ b/citadel/user_ops.c @@ -856,8 +856,23 @@ static int validpw(uid_t uid, const char *pass) begin_critical_section(S_CHKPWD); rv = write(chkpwd_write_pipe[1], &uid, sizeof(uid_t)); + if (rv == -1) { + syslog(LOG_EMERG, "Communicatino with chkpwd broken: %s\n", strerror(errno)); + end_critical_section(S_CHKPWD); + return 0; + } rv = write(chkpwd_write_pipe[1], pass, 256); + if (rv == -1) { + syslog(LOG_EMERG, "Communicatino with chkpwd broken: %s\n", strerror(errno)); + end_critical_section(S_CHKPWD); + return 0; + } rv = read(chkpwd_read_pipe[0], buf, 4); + if (rv == -1) { + syslog(LOG_EMERG, "Communicatino with chkpwd broken: %s\n", strerror(errno)); + end_critical_section(S_CHKPWD); + return 0; + } end_critical_section(S_CHKPWD); if (!strncmp(buf, "PASS", 4)) { @@ -1335,8 +1350,6 @@ void CtdlSetPassword(char *new_pw) */ void cmd_setp(char *new_pw) { - int generate_random_password = 0; - if (CtdlAccessCheck(ac_logged_in)) { return; } @@ -1352,7 +1365,6 @@ void cmd_setp(char *new_pw) if (!strcasecmp(new_pw, "GENERATE_RANDOM_PASSWORD")) { char random_password[17]; - generate_random_password = 1; snprintf(random_password, sizeof random_password, "%08lx%08lx", random(), random()); CtdlSetPassword(random_password); cprintf("%d %s\n", CIT_OK, random_password); @@ -1390,6 +1402,15 @@ void cmd_creu(char *cmdbuf) //password[31] = 0; strproc(username); strproc(password); + len = strlen(username); + if (len >= USERNAME_SIZE) + { + syslog(LOG_EMERG, "Username to long: %s", username); + cit_backtrace (); + len = USERNAME_SIZE - 1; + username[63]='\0'; + } + len = cutuserkey(username); if (IsEmptyStr(username)) { diff --git a/citadel/user_ops.h b/citadel/user_ops.h index b057947c6..7bd7c6b7f 100644 --- a/citadel/user_ops.h +++ b/citadel/user_ops.h @@ -70,7 +70,7 @@ static INLINE long cutuserkey(char *username) { syslog(LOG_EMERG, "Username to long: %s", username); cit_backtrace (); len = USERNAME_SIZE - 1; - ((char*)username)[USERNAME_SIZE - 1]='\0'; + username[63]='\0'; } return len; } diff --git a/citadel/utillib/citadel_dirs.c b/citadel/utillib/citadel_dirs.c index f4cc31071..8037b6d12 100644 --- a/citadel/utillib/citadel_dirs.c +++ b/citadel/utillib/citadel_dirs.c @@ -390,24 +390,39 @@ int create_dir(char *which, long ACCESS, long UID, long GID) { int rv; rv = mkdir(which, ACCESS); + if ((rv == -1) && (errno == EEXIST)) + return rv; rv = chmod(which, ACCESS); + if (rv == -1) + return rv; rv = chown(which, UID, GID); return rv; } -void create_run_directories(long UID, long GID) +int create_run_directories(long UID, long GID) { int rv; rv = create_dir(ctdl_info_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1); - rv = create_dir(ctdl_bio_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1); - rv = create_dir(ctdl_usrpic_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1); - rv = create_dir(ctdl_message_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1); - rv = create_dir(ctdl_hlp_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1); - rv = create_dir(ctdl_image_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1); - rv = create_dir(ctdl_bb_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1); - rv = create_dir(ctdl_file_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1); - rv = create_dir(ctdl_netcfg_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1); - rv = create_dir(ctdl_key_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1); - rv = create_dir(ctdl_run_dir , S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH, UID, GID); + if (rv != -1) + rv = create_dir(ctdl_bio_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1); + if (rv != -1) + rv = create_dir(ctdl_usrpic_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1); + if (rv != -1) + rv = create_dir(ctdl_message_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1); + if (rv != -1) + rv = create_dir(ctdl_hlp_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1); + if (rv != -1) + rv = create_dir(ctdl_image_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1); + if (rv != -1) + rv = create_dir(ctdl_bb_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1); + if (rv != -1) + rv = create_dir(ctdl_file_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1); + if (rv != -1) + rv = create_dir(ctdl_netcfg_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1); + if (rv != -1) + rv = create_dir(ctdl_key_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1); + if (rv != -1) + rv = create_dir(ctdl_run_dir , S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH, UID, GID); + return rv; } -- 2.30.2