Avoid strerror() when possible and just rely on warning/error

to handle errno in the proper locale.
This commit is contained in:
Todd C. Miller
2012-11-09 16:32:29 -05:00
parent e28ce01fe0
commit 56de023de8
6 changed files with 27 additions and 16 deletions

View File

@@ -685,8 +685,10 @@ set_cmnd(void)
}
}
}
if (strlen(user_cmnd) >= PATH_MAX)
errorx(1, _("%s: %s"), user_cmnd, strerror(ENAMETOOLONG));
if (strlen(user_cmnd) >= PATH_MAX) {
errno = ENAMETOOLONG;
error(1, "%s", user_cmnd);
}
if ((user_base = strrchr(user_cmnd, '/')) != NULL)
user_base++;