Imported Upstream version 1.8.2
[debian/sudo] / plugins / sudoers / find_path.c
index 2566733638e1182e554cda8eac5d96b697bcb262..4064248e3d181e06ae927e2c1b731e3737e49828 100644 (file)
@@ -42,6 +42,7 @@
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
 #endif /* HAVE_UNISTD_H */
+#include <errno.h>
 
 #include "sudoers.h"
 
@@ -64,7 +65,7 @@ find_path(char *infile, char **outfile, struct stat *sbp, char *path,
     int len;                   /* length parameter */
 
     if (strlen(infile) >= PATH_MAX)
-       errorx(1, "%s: File name too long", infile);
+       errorx(1, _("%s: %s"), infile, strerror(ENAMETOOLONG));
 
     /*
      * If we were given a fully qualified or relative path
@@ -103,7 +104,7 @@ find_path(char *infile, char **outfile, struct stat *sbp, char *path,
         */
        len = snprintf(command, sizeof(command), "%s/%s", path, infile);
        if (len <= 0 || len >= sizeof(command))
-           errorx(1, "%s: File name too long", infile);
+           errorx(1, _("%s: %s"), infile, strerror(ENAMETOOLONG));
        if ((result = sudo_goodpath(command, sbp)))
            break;
 
@@ -118,7 +119,7 @@ find_path(char *infile, char **outfile, struct stat *sbp, char *path,
     if (!result && checkdot) {
        len = snprintf(command, sizeof(command), "./%s", infile);
        if (len <= 0 || len >= sizeof(command))
-           errorx(1, "%s: File name too long", infile);
+           errorx(1, _("%s: %s"), infile, strerror(ENAMETOOLONG));
        result = sudo_goodpath(command, sbp);
        if (result && ignore_dot)
            return NOT_FOUND_DOT;