setenv cleanup of usr.sbin/resident

看板DFBSD_submit作者時間20年前 (2005/04/22 02:01), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/6 (看更多)
--tThc/1wpZn/ma/RB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Here's a patch to check the return value of setenv () in usr.sbin/resident/resident.c. Joe --tThc/1wpZn/ma/RB Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="resident.c.patch" Index: usr.sbin/resident/resident.c =================================================================== RCS file: /home/dcvs/src/usr.sbin/resident/resident.c,v retrieving revision 1.7 diff -u -r1.7 resident.c --- usr.sbin/resident/resident.c 18 Dec 2004 22:48:05 -0000 1.7 +++ usr.sbin/resident/resident.c 21 Apr 2005 13:47:33 -0000 @@ -151,9 +151,19 @@ /* ld-elf.so magic */ if (doreg) - setenv("LD_RESIDENT_REGISTER_NOW", "yes", 1); + { + if (setenv("LD_RESIDENT_REGISTER_NOW", "yes", 1) == -1) + fprintf (stderr, + "setenv (\"LD_RESIDENT_REGISTER_NOW\") failed: %s", + strerror (errno)); + } else - setenv("LD_RESIDENT_UNREGISTER_NOW", "yes", 1); + { + if (setenv("LD_RESIDENT_UNREGISTER_NOW", "yes", 1) == -1) + fprintf (stderr, + "setenv (\"LD_RESIDENT_UNREGISTER_NOW\") failed: %s", + strerror (errno)); + } rval = 0; for ( ; argc > 0; argc--, argv++) { --tThc/1wpZn/ma/RB--
文章代碼(AID): #12P-gL00 (DFBSD_submit)
文章代碼(AID): #12P-gL00 (DFBSD_submit)