[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: e2fsprogs patch for review (updated)



Svante Signell, le Wed 05 Oct 2011 15:34:53 +0200, a écrit :
> free() does not seem to apply when using the const attribute!?

Yes. You can't free a const char *.

> +#ifdef HAVE_QUOTA_H
>  	char tmp[1024];
>  	qid_t id = (type == USRQUOTA) ? getuid() : getgid();
>  
>  	if (!quotactl(QCMD(Q_V2_GETQUOTA, type), fs->device_name, id, tmp))
>  		return 1;
>  	return 0;
> +#else
> +	return 1;
> +#endif

It's the contrary, see the quotactl manpage: when it succeeds, it
returns 0. So in the HAVE_QUOTA_H not defined case, you should return 0
instead.

>  int quota_file_exists(ext2_filsys fs, int qtype, int fmt)
>  {
> -	char qf_name[256];
> +	const char *qf_name;

drop const then.

> --- e2fsprogs-1.42~WIP-2011-10-01/lib/quota/mkquota.h	2011-09-16 05:40:34.000000000 +0200
> +++ e2fsprogs-1.42~WIP-2011-10-01.modified//lib/quota/mkquota.h	2011-10-05 12:05:27.000000000 +0200
> @@ -59,7 +59,7 @@
>  void set_sb_quota_inum(ext2_filsys fs, ext2_ino_t ino, int qtype);
>  
>  /* in quotaio.c */
> -const char *get_qf_name(int type, int fmt, char *buf);
> +const char *get_qf_name(int type, int fmt);

and from here as well.

Samuel


Reply to: