svn commit: trunk/uClibc/libc/misc/mntent

Peter Kjellerstedt peter.kjellerstedt at axis.com
Mon Nov 12 02:05:16 PST 2007


> -----Original Message-----
> From: uclibc-cvs-bounces at uclibc.org 
> [mailto:uclibc-cvs-bounces at uclibc.org] On Behalf Of kraj at uclibc.org
> Sent: den 10 november 2007 07:43
> To: uclibc-cvs at uclibc.org
> Subject: svn commit: trunk/uClibc/libc/misc/mntent
> 
> Author: kraj
> Date: 2007-11-09 22:42:45 -0800 (Fri, 09 Nov 2007)
> New Revision: 20406
> 
> Log:
> Do not return error when fprintf returns 0 in addmntent().
> fprintf is considered failing if the return is less than 0
> 
> Modified:
>    trunk/uClibc/libc/misc/mntent/mntent.c
> 
> Changeset:
> Modified: trunk/uClibc/libc/misc/mntent/mntent.c
> ===================================================================
> --- trunk/uClibc/libc/misc/mntent/mntent.c	2007-11-10 
> 03:24:21 UTC (rev 20405)
> +++ trunk/uClibc/libc/misc/mntent/mntent.c	2007-11-10 
> 06:42:45 UTC (rev 20406)
> @@ -98,11 +98,8 @@
>  	if (fseek(filep, 0, SEEK_END) < 0)
>  		return 1;
>  
> -	if (fprintf (filep, "%s %s %s %s %d %d\n", mnt->mnt_fsname,
mnt->mnt_dir,
> -		 mnt->mnt_type, mnt->mnt_opts, mnt->mnt_freq,
mnt->mnt_passno) < 1)
> -		return 1;
> -
> -	return 0;
> +	return (fprintf (filep, "%s %s %s %s %d %d\n", mnt->mnt_fsname,
mnt->mnt_dir,
> +		 mnt->mnt_type, mnt->mnt_opts, mnt->mnt_freq,
mnt->mnt_passno) < 0 ? 1 : 0);
>  }
>  
>  char *hasmntopt(const struct mntent *mnt, const char *opt)

Under what circumstances can fprintf() return 0 given that the
format string contains spaces, %d and a line feed?

//Peter


More information about the uClibc mailing list