[PATCH] Fix compiler warning

Michael Adam obnox at samba.org
Fri Oct 16 11:38:38 UTC 2015


On 2015-10-16 at 16:58 +0530, Anoop C S wrote:
> Hi,
> 
> Please see the attached patch which fixes a compiler warning from
> sysquotas_nfs.c

To me, this looks good. I also already discussed this with Anoop.
All definitions of the enum I can find start with 1.
But I don't know all the history. This code originally comes from
source3/smbd/quotas.c, added in 2001:
f439f72ceec665dbd1eae367eb5d7302d8a3338d
Has the definition been different back then? ...

So I tentatively give my review.
(Barring explanation why we need the 0 case... ;-)

If this is OK, then we need the corresponding patch to
smbd/quotas.c, Anoop.

Cheers - Michael


> From b77d64575367a9cabbd755b9eec50ab2e47da6f3 Mon Sep 17 00:00:00 2001
> From: Anoop C S <anoopcs at redhat.com>
> Date: Fri, 9 Oct 2015 11:32:52 +0000
> Subject: [PATCH] s3.lib: Remove invalid switch case from sysquotas_nfs
> 
> getquota_rslt structure from rquota.h defines the enum
> named status whose values start from 1. But in
> sysquotas_nfs.c we have an invalid check for status 0.
> This change is to remove that particular switch case.
> 
> Signed-off-by: Anoop C S <anoopcs at redhat.com>
> ---
>  source3/lib/sysquotas_nfs.c | 7 -------
>  1 file changed, 7 deletions(-)
> 
> diff --git a/source3/lib/sysquotas_nfs.c b/source3/lib/sysquotas_nfs.c
> index 58eedf0..4b37e34 100644
> --- a/source3/lib/sysquotas_nfs.c
> +++ b/source3/lib/sysquotas_nfs.c
> @@ -211,19 +211,12 @@ int sys_get_nfs_quota(const char *path, const char *bdev,
>  
>  	/*
>  	 * gqr.status returns
> -	 *   0 if the rpc call fails,
>  	 *   1 if quotas exist,
>  	 *   2 if there is no quota set, and
>  	 *   3 if no permission to get the quota.
>  	 */
>  
>  	switch (gq_rslt.GQR_STATUS) {
> -	case 0:
> -		DEBUG(3, ("sys_get_nfs_quotas: Remote Quotas Failed! "
> -			  "Error '%i'\n", gq_rslt.GQR_STATUS));
> -		ret = -1;
> -		goto out;
> -
>  	case 1:
>  		DEBUG(10, ("sys_get_nfs_quotas: Good quota data\n"));
>  		dp->bsize = (uint64_t)gq_rslt.GQR_RQUOTA.rq_bsize;
> -- 
> 2.4.3
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20151016/f3abf6fe/signature.sig>


More information about the samba-technical mailing list