[Monetdb-developers] [Monetdb-sql-checkins] sql/src/backends/monet5 merovingian.mx, , 1.9, 1.10

Stefan Manegold Stefan.Manegold at cwi.nl
Sun Nov 25 11:38:45 CET 2007


On Sun, Nov 25, 2007 at 10:18:26AM +0000, Fabian wrote:
> Update of /cvsroot/monetdb/sql/src/backends/monet5
> In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv26685
> 
> Modified Files:
> 	merovingian.mx 
> Log Message:
> Attempt to fix some compiler warnings.  I cannot test myself, as I don't
> get them, and if I use TestWeb's CFLAGS the code doesn't compile at all
> at a much earlier stage.

"TestWeb" does not use any (particular) CFLAGS, but just the default that
(our) configure uses/provides (with --enable-strict, which is default for
the development trunk).

In case you have problems with this (or other) settings, please help us
fixing them by reporting them ans bug report.

The compiler warning is triggered by the following setting in lines 742,3 of
buildtools/conf/MonetDB.m4
========
dnl  The default configure invocation when doing an rpmbuild also uses this
X_CFLAGS="$X_CFLAGS -Wp,-D_FORTIFY_SOURCE=2"
========

Some functions (system calls) do return, whether they were successful, or
not, and the calling ocde should check the respective return values.
Ignoring them via (e.g.)
	(void)write(...);
will (most probably) not help.
Rather, the code should check the results, e.g.,
	if (write(...) < 0) {
		...
	}
or at least pretend to do so, e.g.,
	ssize_t wrt_res = 0;
	wrt_res = write(...);
	(void)wrt_res; /* deliberately irgnore portential errors */

Stefan 


> Index: merovingian.mx
> ===================================================================
> RCS file: /cvsroot/monetdb/sql/src/backends/monet5/merovingian.mx,v
> retrieving revision 1.9
> retrieving revision 1.10
> diff -u -d -r1.9 -r1.10
> --- merovingian.mx	25 Nov 2007 09:55:05 -0000	1.9
> +++ merovingian.mx	25 Nov 2007 10:18:24 -0000	1.10
> @@ -1203,10 +1203,10 @@
>  		case -1:
>  			/* oops, forking went wrong, cheat a bit in order to write to
>  			 * the console */
> -			write(oerr, "unable to fork into background: ", 
> +			(void)write(oerr, "unable to fork into background: ", 
>  					sizeof("unable to fork into background: "));
> -			write(oerr, strerror(errno), strlen(strerror(errno)));
> -			write(oerr, "\n", 1);
> +			(void)write(oerr, strerror(errno), strlen(strerror(errno)));
> +			(void)write(oerr, "\n", 1);
>  			return(1);
>  		case 0:
>  			/* the child, we want to keep it, try to lock, we can only
> @@ -1217,17 +1217,17 @@
>  			 * remain available, otherwise we loose the lock */
>  			if ((ret = MT_lockf(buf, F_TLOCK, 4, 1)) == -1) {
>  				/* locking failed */
> -				write(oerr, "another merovingian is already running\n",
> +				(void)write(oerr, "another merovingian is already running\n",
>  						sizeof("another merovingian is already running\n"));
>  				exit(1);
>  			} else if (ret == -2) {
>  				/* directory or something doesn't exist */
> -				write(oerr, "unable to create .merovingian_lock file in ",
> +				(void)write(oerr, "unable to create .merovingian_lock file in ",
>  						sizeof("unable to create .merovingian_lock file in "));
> -				write(oerr, dbfarm, strlen(dbfarm));
> -				write(oerr, ": ", 2);
> -				write(oerr, strerror(errno), strlen(strerror(errno)));
> -				write(oerr, "\n", 1);
> +				(void)write(oerr, dbfarm, strlen(dbfarm));
> +				(void)write(oerr, ": ", 2);
> +				(void)write(oerr, strerror(errno), strlen(strerror(errno)));
> +				(void)write(oerr, "\n", 1);
>  				exit(1);
>  			}
>  
> 
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Monetdb-sql-checkins mailing list
> Monetdb-sql-checkins at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins
> 

-- 
| Dr. Stefan Manegold | mailto:Stefan.Manegold at cwi.nl |
| CWI,  P.O.Box 94079 | http://www.cwi.nl/~manegold/  |
| 1090 GB Amsterdam   | Tel.: +31 (20) 592-4212       |
| The Netherlands     | Fax : +31 (20) 592-4312       |




More information about the developers-list mailing list