Changeset a785c27 in code for icb.c


Ignore:
Timestamp:
Jan 8, 2010, 1:16:34 PM (15 years ago)
Author:
Mike Belopuhov <mike.belopuhov@…>
Branches:
master
Children:
c45628b
Parents:
8bf5a0a
Message:

allow specifying a server name; do hostname evaluation only once

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icb.c

    r8bf5a0a ra785c27  
    2929
    3030extern int creategroups;
     31extern char srvname[MAXHOSTNAMELEN];
    3132
    3233void   icb_command(struct icb_session *, char *, char *);
     
    4647
    4748        LIST_INIT(&groups);
     49
     50        if (strlen(srvname) == 0)
     51                (void)gethostname(srvname, sizeof srvname);
     52        /*
     53         * MAXHOSTNAMELEN is usually greater than what we
     54         * can actually send, hence truncation:
     55         */
     56        if (strlen(srvname) > 200)
     57                srvname[200] = '\0';
    4858}
    4959
     
    5464icb_start(struct icb_session *is)
    5565{
    56         char hname[MAXHOSTNAMELEN];
    57 
    58         bzero(hname, sizeof hname);
    59         (void)gethostname(hname, sizeof hname);
    60         icb_sendfmt(is, "%c%c%c%s%c%s", ICB_M_PROTO, '1', ICB_M_SEP, hname,
     66        icb_sendfmt(is, "%c%c%c%s%c%s", ICB_M_PROTO, '1', ICB_M_SEP, srvname,
    6167            ICB_M_SEP, "icbd");
    6268        SETF(is->flags, ICB_SF_PROTOSENT);
Note: See TracChangeset for help on using the changeset viewer.