Bug 1579

Summary: mount: nfs_strerror() broken for EDQUOT on mips
Product: Busybox Reporter: Jonas Gorski <jonas.gorski+bbbugs>
Component: OtherAssignee: unassigned
Status: RESOLVED FIXED    
Severity: trivial CC: busybox-cvs
Priority: P5    
Version: 1.16.x   
Target Milestone: ---   
Hardware: Other   
OS: Linux   
Host: Target: mips
Build: 1.16.1

Description Jonas Gorski 2010-04-16 00:15:16 UTC
Compiling busybox for mips produces a warning on compilation of mount.c that a too long value was truncated.

Reason is that:

static const uint8_t nfs_err_errnum[] = {
	EPERM , ENOENT      , EIO      , ENXIO , EACCES, EEXIST,
	ENODEV, ENOTDIR     , EISDIR   , EINVAL, EFBIG , ENOSPC,
	EROFS , ENAMETOOLONG, ENOTEMPTY, EDQUOT, ESTALE, EREMOTE
};

but asm/errno.h for mips has:

#define EDQUOT          1133    /* Quota exceeded */

changing nfs_err_errnum to uint16_t should fix this.

P.S: MIPS isn't the only architecture with errnums bigger than 255, but the only one with one used here.
Comment 1 Denys Vlasenko 2010-05-19 14:44:14 UTC
Proposed fix:

#if   ( EPERM | ENOENT      | EIO      | ENXIO | EACCES| EEXIST | \
        ENODEV| ENOTDIR     | EISDIR   | EINVAL| EFBIG | ENOSPC | \
        EROFS | ENAMETOOLONG| ENOTEMPTY| EDQUOT| ESTALE| EREMOTE) < 256
typedef uint8_t nfs_err_type;
#else
typedef uint16_t nfs_err_type;
#endif
static const nfs_err_type nfs_err_errnum[] = {
        EPERM , ENOENT      , EIO      , ENXIO , EACCES, EEXIST,
        ENODEV, ENOTDIR     , EISDIR   , EINVAL, EFBIG , ENOSPC,
        EROFS , ENAMETOOLONG, ENOTEMPTY, EDQUOT, ESTALE, EREMOTE
};
Comment 2 Denys Vlasenko 2010-05-19 15:02:32 UTC
Fixed in git, thanks!