From 26599f2c005d6f17a724948621124dc275a6418d64e14855023c31edd64e15f7 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Thu, 29 Jul 2010 06:20:23 +0000 Subject: [PATCH] Accepting request 44084 from home:elvigia:branches:Base:System Copy from home:elvigia:branches:Base:System/aaa_base via accept of submit request 44084 revision 2. Request was accepted with message: Reviewed ok OBS-URL: https://build.opensuse.org/request/show/44084 OBS-URL: https://build.opensuse.org/package/show/Base:System/aaa_base?expand=0&rev=130 --- aaa_base.changes | 5 +++++ get_kernel_version.c | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/aaa_base.changes b/aaa_base.changes index 19872a3..e51fc87 100644 --- a/aaa_base.changes +++ b/aaa_base.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Jul 27 15:34:59 UTC 2010 - cristian.rodriguez@opensuse.org + +- get_kernel_version : use O_CLOEXEC everywhere + ------------------------------------------------------------------- Fri Jul 16 17:22:27 CEST 2010 - werner@suse.de diff --git a/get_kernel_version.c b/get_kernel_version.c index edc5509..b1f706c 100644 --- a/get_kernel_version.c +++ b/get_kernel_version.c @@ -14,6 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#define _GNU_SOURCE #include #include #include @@ -47,7 +48,7 @@ main (int argc, char *argv[]) /* check if file exist and is compressed */ { unsigned char buf [2]; - int fd = open (argv[1], O_RDONLY); + int fd = open (argv[1], O_RDONLY | O_CLOEXEC); if (fd == -1) { fprintf (stderr, "Cannot open kernel image \"%s\"\n", argv[1]); @@ -64,7 +65,7 @@ main (int argc, char *argv[]) if (buf [0] == 037 && (buf [1] == 0213 || buf [1] == 0236)) { snprintf (command, sizeof (command), "/bin/gzip -dc %s 2>/dev/null", argv[1]); - fp = popen (command, "r"); + fp = popen (command, "re"); if (fp == NULL) { fprintf (stderr, "%s: faild\n", command); @@ -73,7 +74,7 @@ main (int argc, char *argv[]) } else { - fp = fopen (argv[1],"r"); + fp = fopen (argv[1],"re"); } close (fd); }