X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=utils%2Fmount%2Ferror.c;h=83ad1d2f796a29551e5beb797966ff17e475c8e9;hp=10d4ed28e187ee9c224b3432ce600163a9543ed0;hb=12544486ef2de86e4f2dfc920cd2860fb81658d1;hpb=bf3527ba9bf181ff07337b7183ad28894deb8b13 diff --git a/utils/mount/error.c b/utils/mount/error.c index 10d4ed2..83ad1d2 100644 --- a/utils/mount/error.c +++ b/utils/mount/error.c @@ -16,14 +16,17 @@ * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 021110-1307, USA. + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 0211-1301 USA * * To Do: * + Proper support for internationalization */ -#include "config.h" +#ifdef HAVE_CONFIG_H +#include +#endif + #include #include #include @@ -32,8 +35,6 @@ #include #include #include -#include -#include #include "xcommon.h" #include "nls.h" @@ -69,9 +70,15 @@ static int rpc_strerror(int spos) pos = snprintf(tmp, (erreob - tmp), _("System Error: %s"), strerror(cf_errno)); - else - pos = snprintf(tmp, (erreob - tmp), - _("RPC Error:%s"), estr); + else { + if (cf_errno) + pos = snprintf(tmp, (erreob - tmp), + _("RPC Error:%s; errno = %s"), + estr, strerror(cf_errno)); + else + pos = snprintf(tmp, (erreob - tmp), + _("RPC Error:%s"), estr); + } } return pos; } @@ -224,9 +231,17 @@ void mount_error(const char *spec, const char *mount_point, int error) nfs_error(_("%s: mount point %s does not exist"), progname, mount_point); break; + case ESPIPE: + 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"), @@ -291,6 +306,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; @@ -320,19 +337,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; }