Displaying 5 results from an estimated 5 matches for "argv_realloc_fail".
2020 Jun 02
0
[PATCH nbdkit 2/5] vddk: Move reexec code to a new file.
...n += r;
+ } while (len == buflen);
+ nbdkit_debug ("original command line occupies %zu bytes", len);
+
+ /* Split cmdline into argv, then append one more arg. */
+ buflen = len;
+ len = 0;
+ while (len < buflen) {
+ if (string_vector_append (&argv, buf + len) == -1) {
+ argv_realloc_fail:
+ nbdkit_debug ("argv: realloc: %m");
+ return;
+ }
+ len += strlen (buf + len) + 1;
+ }
+ if (!env)
+ env = "";
+ nbdkit_debug ("adding reexeced_=%s", env);
+ if (asprintf (&reexeced, "reexeced_=%s", env) == -1)
+ goto argv_rea...
2020 Jun 02
9
[PATCH nbdkit 0/5] vddk: Fix password parameter.
Probably needs a bit of cleanup, but seems like it is generally the
right direction.
One thing I've noticed is that the expect test randomly (but rarely)
hangs :-( I guess something is racey but I don't know what at the
moment.
Rich.
2020 Apr 19
2
[PATCH nbdkit 1/2] vddk: Use new vector library to allocate the argv list.
...nv, const char *prepend)
buflen = len;
len = 0;
while (len < buflen) {
- char **tmp = realloc (argv, sizeof *argv * (argc + 3));
-
- if (!tmp) {
- nbdkit_debug ("failure to parse original argv: %m");
+ if (string_vector_append (&argv, buf + len) == -1) {
+ argv_realloc_fail:
+ nbdkit_debug ("argv: realloc: %m");
return;
}
- argv = tmp;
- argv[argc++] = buf + len;
len += strlen (buf + len) + 1;
}
if (!env)
env = "";
- nbdkit_debug ("original argc == %d, adding reexeced_=%s", argc, env);
- if (asprin...
2020 Jun 02
0
[PATCH nbdkit 3/5] vddk: Miscellaneous improvements to reexec code.
...argv, then append one more arg. */
- buflen = len;
- len = 0;
- while (len < buflen) {
- if (string_vector_append (&argv, buf + len) == -1) {
+ for (len = 0; len < buf.size; len += strlen (buf.ptr + len) + 1) {
+ if (string_vector_append (&argv, buf.ptr + len) == -1) {
argv_realloc_fail:
nbdkit_debug ("argv: realloc: %m");
return;
}
- len += strlen (buf + len) + 1;
}
+
if (!env)
env = "";
nbdkit_debug ("adding reexeced_=%s", env);
@@ -139,8 +152,8 @@ perform_reexec (const char *env, const char *prepend)
nbdkit_...
2020 Jun 02
0
[PATCH nbdkit 5/5] vddk: Munge password parameters when we reexec (RHBZ#1842440).
...mp;password_fd, "password=-%d", fd) == -1) {
+ nbdkit_error ("asprintf: %m");
+ exit (EXIT_FAILURE);
+ }
+ /* Leaked here but cleaned up when we exec below. */
+ arg = password_fd;
+ }
+
+ if (string_vector_append (&argv, arg) == -1) {
argv_realloc_fail:
nbdkit_debug ("argv: realloc: %m");
return;
diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c
index eb865cc2..f2696fa6 100644
--- a/plugins/vddk/vddk.c
+++ b/plugins/vddk/vddk.c
@@ -82,7 +82,7 @@ static const char *cookie; /* cookie */
static const cha...