Changeset 7a9d968 for unix.c


Ignore:
Timestamp:
2018-03-10T11:30:39Z (6 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Children:
5447c59
Parents:
3f44e43 (diff), 4a9c6b0 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into HEAD

File:
1 edited

Legend:

Unmodified
Added
Removed
  • unix.c

    r3f44e43 r7a9d968  
    147147                struct passwd *pw = NULL;
    148148                pw = getpwnam(global.conf->user);
    149                 if (pw) {
    150                         initgroups(global.conf->user, pw->pw_gid);
    151                         setgid(pw->pw_gid);
    152                         setuid(pw->pw_uid);
    153                 } else {
    154                         log_message(LOGLVL_WARNING, "Failed to look up user %s.", global.conf->user);
     149                if (!pw) {
     150                        log_message(LOGLVL_ERROR, "Failed to look up user %s.", global.conf->user);
     151
     152                } else if (initgroups(global.conf->user, pw->pw_gid) != 0) {
     153                        log_message(LOGLVL_ERROR, "initgroups: %s.", strerror(errno));
     154
     155                } else if (setgid(pw->pw_gid) != 0) {
     156                        log_message(LOGLVL_ERROR, "setgid(%d): %s.", pw->pw_gid, strerror(errno));
     157
     158                } else if (setuid(pw->pw_uid) != 0) {
     159                        log_message(LOGLVL_ERROR, "setuid(%d): %s.", pw->pw_uid, strerror(errno));
    155160                }
    156161        }
     
    281286static void sighandler_shutdown(int signal)
    282287{
     288        int unused G_GNUC_UNUSED;
    283289        /* Write a single null byte to the pipe, just to send a message to the main loop.
    284290         * This gets handled by bitlbee_shutdown (the b_input_add callback for this pipe) */
    285         write(shutdown_pipe.fd[1], "", 1);
     291        unused = write(shutdown_pipe.fd[1], "", 1);
    286292}
    287293
     
    292298{
    293299        GSList *l;
     300        int unused G_GNUC_UNUSED;
    294301        const char *message = "ERROR :BitlBee crashed! (SIGSEGV received)\r\n";
    295302        int len = strlen(message);
     
    298305                irc_t *irc = l->data;
    299306                sock_make_blocking(irc->fd);
    300                 write(irc->fd, message, len);
     307                unused = write(irc->fd, message, len);
    301308        }
    302309
Note: See TracChangeset for help on using the changeset viewer.