diff --git a/src/nwvolume.c b/src/nwvolume.c index dfe0305..b56cd17 100644 --- a/src/nwvolume.c +++ b/src/nwvolume.c @@ -938,9 +938,14 @@ const char *find_device_file(const char *path) /* Modern glibc declares quotactl() in . The old _syscall4() * wrapper no longer builds on current systems, so do not provide a private * syscall stub here. + * + * Prefer Q_SETQUOTA when available. Q_SETQLIM can fail with ESRCH when no + * dquot record exists yet; Q_SETQUOTA is the modern "write this dqblk" API. */ -# if !defined(Q_SETQLIM) && defined(Q_SETQUOTA) -# define Q_SETQLIM Q_SETQUOTA +# if defined(Q_SETQUOTA) +# define MARS_Q_SETQUOTA Q_SETQUOTA +# elif defined(Q_SETQLIM) +# define MARS_Q_SETQUOTA Q_SETQLIM # endif #endif /* LINUX */ @@ -1019,7 +1024,7 @@ int nw_set_vol_restrictions(uint8 volnr, int uid, uint32 quota) dqblk.dqb_ihardlimit, dqblk.dqb_curinodes)); - res=su_quotactl(QCMD(Q_SETQLIM, USRQUOTA), device, uid, (caddr_t) &dqblk); + res=su_quotactl(QCMD(MARS_Q_SETQUOTA, USRQUOTA), device, uid, (caddr_t) &dqblk); if (res != 0) { XDPRINTF((2,0, "Set quota failed device=%s uid=%d quota=%dK errno=%d", device, uid, quota, errno));