Andrew Savchenko

Reset errno before argument parsing

If errno is not reset before strtol call, it may trigger false str
to long conversation error, e.g. with absent /etc/{group,passwd}:

  # chroot /root/clsync /bin/clsync -M direct -W a -D b -r 10 -S /sbin/echo -t 1 -w 1 --secure-splitting
  Error: argument "10" can't be parsed as a number (2: No such file or directory)
Showing 1 changed file with 1 additions and 0 deletions
... ... @@ -813,6 +813,7 @@ static inline long xstrtol(const char *str, int *err) {
long res;
char *endptr;
errno = 0;
res = strtol(str, &endptr, 0);
if (errno || *endptr) {
error("argument \"%s\" can't be parsed as a number", str);
... ...