aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxin John <maxin.john@intel.com>2017-01-17 18:20:34 +0200
committerArmin Kuster <akuster808@gmail.com>2017-04-01 08:41:18 -0400
commita6e172ff551df4ea74cb4657744706e4568e1873 (patch)
treeaac41e779135021a5d326b128e3c699285c570f9
parent14f38ecea7d06d2759e2b63905a5e26a1fe62f60 (diff)
downloadopenembedded-core-contrib-a6e172ff551df4ea74cb4657744706e4568e1873.tar.gz
busybox: refresh the flock patch
Upstream accepted the flock fix with some improvements. Backport those changes. Signed-off-by: Maxin B. John <maxin.john@intel.com> Signed-off-by: Maxin B. John <maxin.john@intel.com> Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r--meta/recipes-core/busybox/busybox/0001-flock-update-the-behaviour-of-c-parameter-to-match-u.patch77
1 files changed, 34 insertions, 43 deletions
diff --git a/meta/recipes-core/busybox/busybox/0001-flock-update-the-behaviour-of-c-parameter-to-match-u.patch b/meta/recipes-core/busybox/busybox/0001-flock-update-the-behaviour-of-c-parameter-to-match-u.patch
index 8bcbd73de9..78520f0d90 100644
--- a/meta/recipes-core/busybox/busybox/0001-flock-update-the-behaviour-of-c-parameter-to-match-u.patch
+++ b/meta/recipes-core/busybox/busybox/0001-flock-update-the-behaviour-of-c-parameter-to-match-u.patch
@@ -1,35 +1,24 @@
-From 198f18addf1d814c2fefcb492f3b9fbd221669bb Mon Sep 17 00:00:00 2001
-From: "Maxin B. John" <maxin.john@intel.com>
-Date: Wed, 20 Apr 2016 18:24:45 +0300
-Subject: [PATCH] flock: update the behaviour of -c parameter to match upstream
-
-In upstream, -c 'PROG ARGS' means "run sh -c 'PROG ARGS'"
+From e1d426fd65c00a6d01a10d85edf8a294ae8a2d2b Mon Sep 17 00:00:00 2001
+From: Denys Vlasenko <vda.linux@googlemail.com>
+Date: Sun, 24 Apr 2016 18:19:49 +0200
+Subject: [PATCH] flock: fix -c; improve error handling of fork+exec
function old new delta
-flock_main 286 377 +91
-.rodata 155849 155890 +41
+flock_main 254 334 +80
-Upstream-Status: Submitted
-[ http://lists.busybox.net/pipermail/busybox/2016-April/084142.html ]
+Upstream-Status: Backport
+Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Signed-off-by: Maxin B. John <maxin.john@intel.com>
---
- util-linux/flock.c | 20 ++++++++++++++------
- 1 file changed, 14 insertions(+), 6 deletions(-)
+ util-linux/flock.c | 19 +++++++++++++++++--
+ 1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/util-linux/flock.c b/util-linux/flock.c
-index 05a747f..c85a25d 100644
+index 05a747f..539a835 100644
--- a/util-linux/flock.c
+++ b/util-linux/flock.c
-@@ -20,6 +20,7 @@ int flock_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
- int flock_main(int argc UNUSED_PARAM, char **argv)
- {
- int mode, opt, fd;
-+ char *cmd_args[4];
- enum {
- OPT_s = (1 << 0),
- OPT_x = (1 << 1),
-@@ -57,7 +58,6 @@ int flock_main(int argc UNUSED_PARAM, char **argv)
+@@ -57,7 +57,6 @@ int flock_main(int argc UNUSED_PARAM, char **argv)
/* If it is "flock FILE -c PROG", then -c isn't caught by getopt32:
* we use "+" in order to support "flock -opt FILE PROG -with-opts",
* we need to remove -c by hand.
@@ -37,35 +26,37 @@ index 05a747f..c85a25d 100644
*/
if (argv[0]
&& argv[0][0] == '-'
-@@ -65,7 +65,10 @@ int flock_main(int argc UNUSED_PARAM, char **argv)
- || (ENABLE_LONG_OPTS && strcmp(argv[0] + 1, "-command") == 0)
+@@ -66,6 +65,9 @@ int flock_main(int argc UNUSED_PARAM, char **argv)
)
) {
-- argv++;
-+ if (argc != optind + 3)
-+ bb_error_msg_and_die("-c requires exactly one command argument");
-+ else
-+ argv++;
+ argv++;
++ if (argv[1])
++ bb_error_msg_and_die("-c takes only one argument");
++ opt |= OPT_c;
}
if (OPT_s == LOCK_SH && OPT_x == LOCK_EX && OPT_n == LOCK_NB && OPT_u == LOCK_UN) {
-@@ -89,9 +92,14 @@ int flock_main(int argc UNUSED_PARAM, char **argv)
- return EXIT_FAILURE;
+@@ -90,8 +92,21 @@ int flock_main(int argc UNUSED_PARAM, char **argv)
bb_perror_nomsg_and_die();
}
--
+
- if (argv[0])
-- return spawn_and_wait(argv);
--
-+ if (argv[0]) {
-+ cmd_args[0] = getenv("SHELL");
-+ if (!cmd_args[0])
-+ cmd_args[0] = (char*)DEFAULT_SHELL;
-+ cmd_args[1] = (char*)"-c";
-+ cmd_args[2] = argv[0];
-+ cmd_args[3] = NULL;
-+ return spawn_and_wait(cmd_args);
-+ }
++ if (argv[0]) {
++ if (!(opt & OPT_c)) {
++ int rc = spawn_and_wait(argv);
++ if (rc < 0)
++ bb_simple_perror_msg(argv[0]);
++ return rc;
++ }
++ /* -c 'PROG ARGS' means "run sh -c 'PROG ARGS'" */
++ argv -= 2;
++ argv[0] = (char*)get_shell_name();
++ argv[1] = (char*)"-c";
++ /* argv[2] = "PROG ARGS"; */
++ /* argv[3] = NULL; */
+ return spawn_and_wait(argv);
++ }
+
return EXIT_SUCCESS;
}
--