contrib/chg/chg.c
changeset 30676 b83bddfc8048
parent 30621 d7875bfbfccb
child 30677 c80c16a8a0b0
equal deleted inserted replaced
30675:112915e9a363 30676:b83bddfc8048
    33 	char sockname[UNIX_PATH_MAX];
    33 	char sockname[UNIX_PATH_MAX];
    34 	char initsockname[UNIX_PATH_MAX];
    34 	char initsockname[UNIX_PATH_MAX];
    35 	char redirectsockname[UNIX_PATH_MAX];
    35 	char redirectsockname[UNIX_PATH_MAX];
    36 	size_t argsize;
    36 	size_t argsize;
    37 	const char **args;
    37 	const char **args;
    38 	int sockdirfd;
       
    39 };
    38 };
    40 
    39 
    41 static void initcmdserveropts(struct cmdserveropts *opts) {
    40 static void initcmdserveropts(struct cmdserveropts *opts) {
    42 	memset(opts, 0, sizeof(struct cmdserveropts));
    41 	memset(opts, 0, sizeof(struct cmdserveropts));
    43 	opts->sockdirfd = -1;
       
    44 }
    42 }
    45 
    43 
    46 static void freecmdserveropts(struct cmdserveropts *opts) {
    44 static void freecmdserveropts(struct cmdserveropts *opts) {
    47 	free(opts->args);
    45 	free(opts->args);
    48 	opts->args = NULL;
    46 	opts->args = NULL;
    49 	opts->argsize = 0;
    47 	opts->argsize = 0;
    50 	if (opts->sockdirfd >= 0) {
       
    51 		close(opts->sockdirfd);
       
    52 		opts->sockdirfd = -1;
       
    53 	}
       
    54 }
    48 }
    55 
    49 
    56 /*
    50 /*
    57  * Test if an argument is a sensitive flag that should be passed to the server.
    51  * Test if an argument is a sensitive flag that should be passed to the server.
    58  * Return 0 if not, otherwise the number of arguments starting from the current
    52  * Return 0 if not, otherwise the number of arguments starting from the current