DragonFly BSD
DragonFly submit List (threaded) for 2005-04
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: setenv cleanup of usr.sbin/resident


From: Joe Talbott <josepht@xxxxxxxxxx>
Date: Thu, 21 Apr 2005 20:52:41 -0400
Mail-followup-to: submit@crater.dragonflybsd.org

On Thu, Apr 21, 2005 at 08:42:01PM +0200, liamfoy@xxxxxxxxxxxxx wrote:
> 
> Joe Talbott <jtalbott@xxxxxxxxx> wrote on 21.04.2005, 16:22:45:
> > Here's a patch to check the return value of setenv () in
> > usr.sbin/resident/resident.c.  
> > 
> > Joe
> 
> Hey Joe,
> 
> This is ok except we dont role our own err/warn messages. Could
> you replace the fprintf() and strerror() with warn()? :-)
> 

Oh and here's the patch. Doh!

Joe
Index: resident.c
===================================================================
RCS file: /home/dcvs/src/usr.sbin/resident/resident.c,v
retrieving revision 1.7
diff -u -r1.7 resident.c
--- resident.c	18 Dec 2004 22:48:05 -0000	1.7
+++ resident.c	22 Apr 2005 00:44:32 -0000
@@ -151,9 +151,15 @@
 
 	/* ld-elf.so magic */
 	if (doreg)
-	    setenv("LD_RESIDENT_REGISTER_NOW", "yes", 1);
+	{
+	    if (setenv("LD_RESIDENT_REGISTER_NOW", "yes", 1) == -1)
+		warn ("setenv");
+	}
 	else
-	    setenv("LD_RESIDENT_UNREGISTER_NOW", "yes", 1);
+	{
+	    if (setenv("LD_RESIDENT_UNREGISTER_NOW", "yes", 1) == -1)
+		warn ("setenv");
+	}
 
 	rval = 0;
 	for ( ;  argc > 0;  argc--, argv++) {


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