silence 2 more warningsi; fix a potential NULL assignment on the way
This commit is contained in:
+8
-3
@@ -310,9 +310,14 @@ process_command_line(int argc, char **argv)
|
||||
case 'd':
|
||||
/* Add to a list of drivers to be initialized later...*/
|
||||
if (num_drivers < MAX_DRIVERS) {
|
||||
drivernames[num_drivers] = malloc( strlen(optarg)+1 );
|
||||
strcpy( drivernames[num_drivers], optarg );
|
||||
num_drivers ++;
|
||||
drivernames[num_drivers] = strdup(optarg);
|
||||
if (drivernames[num_drivers] != NULL) {
|
||||
num_drivers ++;
|
||||
}
|
||||
else {
|
||||
report(RPT_ERR, "alloc error storing driver name: %s", optarg);
|
||||
e = -1
|
||||
}
|
||||
} else {
|
||||
report( RPT_ERR, "Too many drivers!" );
|
||||
e = -1;
|
||||
|
||||
+1
-1
@@ -315,7 +315,7 @@ sock_printf_error(int fd, const char *format, .../*args*/ )
|
||||
va_list ap;
|
||||
int size = 0;
|
||||
|
||||
strcpy(buf, huh);
|
||||
strncpy(buf, huh, sizeof(huh)); // note: sizeof(huh) < MAXMSG
|
||||
|
||||
va_start(ap, format);
|
||||
size = vsnprintf(buf + (sizeof(huh)-1), sizeof(buf) - (sizeof(huh)-1), format, ap);
|
||||
|
||||
Reference in New Issue
Block a user