Patches against the dracut git version
Hello,
I'm attaching the following patches against the current development version of dracut:
0001-Fix-parsing-command-line-arguments.patch 0002-Use-consistiently-termination-code-macros.patch 0003-Always-check-the-return-number-of-asprintf.patch 0004-Fix-memory-leak.patch
Please double check and apply them.
Regards,
From f9a63777f744e14dc9244ada09190e84a741bfb4 Mon Sep 17 00:00:00 2001
From: Kamil Rytarowski <[email protected]>
Date: Sat, 11 May 2013 11:39:46 +0200
Subject: [PATCH 1/4] Fix parsing command line arguments
Adjust correctly the *optstring argument of getopt_long. Add support for a missing option -v|--verbose and drop unknown options -D, -I and -L.
--- install/dracut-install.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
install/dracut-install.c +1 -1
@@ -619,8 +619,7 @@ static int parse_argv(int argc, char *argv[]) {NULL, 0, NULL, 0} }; -while ((c =getopt_long (argc, argv,"adhloD:DHILR" , options,NULL )) !=-1 ) { +while ((c =getopt_long (argc, argv,"adhlovD:HR" , options,NULL )) !=-1 ) {switch (c) {case ARG_VERSION :puts (PROGRAM_VERSION_STRING );
Signature · 1 line
1.8.1.5
From a874eacf340e62e5a5d2ed3fe9f2ec2cae256f87 Mon Sep 17 00:00:00 2001
From: Kamil Rytarowski <[email protected]>
Date: Sat, 11 May 2013 13:49:00 +0200
Subject: [PATCH 2/4] Use consistiently termination code macros
Operate in install_all and install_one consequently on EXIT_SUCCESS and EXIT_FAILURE termination code macros as they are meant to be returned from these functions.
--- install/dracut-install.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
install/dracut-install.c +2 -2
@@ -757,7 +757,7 @@ static char *find_binary(const char *src)static int install_one (const char *src,const char *dst) { -int r =0 ; +int r =EXIT_SUCCESS ;int ret;if (strchr (src,'/' ) ==NULL ) {
@@ -786,7 +786,7 @@ static int install_one(const char *src, const char *dst)static int install_all (int argc,char **argv) { -int r =0 ; +int r =EXIT_SUCCESS ;int i;for (i =0 ; i < argc; i++) {int ret;
Signature · 1 line
1.8.1.5
From 7bc69fb081e129f2583b1ac8b45f290f6caa99c5 Mon Sep 17 00:00:00 2001
From: Kamil Rytarowski <[email protected]>
Date: Sat, 11 May 2013 14:40:19 +0200
Subject: [PATCH 3/4] Always check the return number of asprintf
asprintf prints to an allocated string. When successful, the functions return the number of bytes printed. If memory allocation wasn't possible, or some other error occurs, the function will return -1.
Don't check strp as a result of asprintf, it's content may be undefined.
man 3 asprintf
--- install/dracut-install.c | 59 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 48 insertions(+), 11 deletions(-)
install/dracut-install.c +48 -11
114 lines not on this page · raw message
Signature · 1 line
1.8.1.5
From e1b55aad7d4de95b7ff502e878bb225bfebb800a Mon Sep 17 00:00:00 2001
From: Kamil Rytarowski <[email protected]>
Date: Sat, 11 May 2013 14:54:38 +0200
Subject: [PATCH 4/4] Fix memory leak
--- install/dracut-install.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
install/dracut-install.c +1 -1
@@ -258,7 +258,7 @@ static int resolve_deps(const char *src) {int ret =0 ; -char *buf =malloc (LINE_MAX ); + _cleanup_free_ char *buf = malloc(LINE_MAX);size_t linesize =LINE_MAX ; _cleanup_pclose_ FILE *fptr = NULL; _cleanup_free_ char *cmd = NULL;
Signature · 1 line
1.8.1.5
A message that is not in the archive (sent off-list or not yet received): [email protected]
Harald Hoyer
AppliedQuoted 9 lines · Kamil Rytarowski
Hello,
I'm attaching the following patches against the current development version of dracut:
0001-Fix-parsing-command-line-arguments.patch 0002-Use-consistiently-termination-code-macros.patch 0003-Always-check-the-return-number-of-asprintf.patch 0004-Fix-memory-leak.patch
Quoted 3 lines
Please double check and apply them.
Regards,
Thanks! Applied!