]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - utils/mount/error.c
mount.nfs: Squelch compiler warnings in nfs_strerror()
[nfs-utils.git] / utils / mount / error.c
index 147e919bd56fdd29649ed205f7233ba66e6681b4..4cc9e0949e3645dbbd6b17c077161e3adb5ab2f5 100644 (file)
@@ -35,8 +35,6 @@
 #include <fcntl.h>
 #include <syslog.h>
 #include <rpc/rpc.h>
-#include <rpc/pmap_prot.h>
-#include <rpc/pmap_clnt.h>
 
 #include "xcommon.h"
 #include "nls.h"
@@ -231,8 +229,13 @@ void mount_error(const char *spec, const char *mount_point, int error)
                rpc_mount_errors((char *)spec, 0, 0);
                break;
        case EIO:
+               nfs_error(_("%s: mount system call failed"), progname);
+               break;
        case EFAULT:
-               nfs_error(_("%s: internal error"), progname);
+               nfs_error(_("%s: encountered unexpected error condition."),
+                               progname);
+               nfs_error(_("%s: please report the error to" PACKAGE_BUGREPORT),
+                               progname);
                break;
        default:
                nfs_error(_("%s: %s"),
@@ -297,6 +300,8 @@ void umount_error(int err, const char *dev)
 #define EDQUOT ENOSPC
 #endif
 
+#define ARRAY_SIZE(x)          (sizeof(x) / sizeof((x)[0])) 
+
 static struct {
        enum nfsstat stat;
        int errnum;
@@ -326,19 +331,17 @@ static struct {
 #endif
        /* Throw in some NFSv3 values for even more fun (HP returns these) */
        { 71,                   EREMOTE         },
-
-       { -1,                   EIO             }
 };
 
-char *nfs_strerror(int stat)
+char *nfs_strerror(unsigned int stat)
 {
-       int i;
+       unsigned int i;
        static char buf[256];
 
-       for (i = 0; nfs_errtbl[i].stat != -1; i++) {
+       for (i = 0; i < ARRAY_SIZE(nfs_errtbl); i++) {
                if (nfs_errtbl[i].stat == stat)
                        return strerror(nfs_errtbl[i].errnum);
        }
-       sprintf(buf, _("unknown nfs status return value: %d"), stat);
+       sprintf(buf, _("unknown nfs status return value: %u"), stat);
        return buf;
 }