Set errno to 0 before calling strtol.

This commit is contained in:
Nathan Florea 2011-10-20 18:20:58 -07:00 committed by antirez
parent b508aeb994
commit bb48c5fa67

View File

@ -74,6 +74,7 @@ void loadServerConfig(char *filename) {
} else if (!strcasecmp(argv[0],"unixsocket") && argc == 2) {
server.unixsocket = zstrdup(argv[1]);
} else if (!strcasecmp(argv[0],"unixsocketperm") && argc == 2) {
errno = 0;
server.unixsocketperm = (mode_t)strtol(argv[1], NULL, 8);
if (errno || server.unixsocketperm > 0777) {
err = "Invalid socket file permissions"; goto loaderr;