search for: saveptr

Displaying 20 results from an estimated 44 matches for "saveptr".

2015 Jun 23
2
[PATCH] daemon: Rewrite prog_exists so it uses the actual PATH, not hard-coded list.
...t i; - char buf[1024]; - - for (i = 0; i < sizeof dirs / sizeof dirs[0]; ++i) { - snprintf (buf, sizeof buf, "%s/%s", dirs[i], prog); - if (access (buf, X_OK) == 0) + const char *pathc = getenv ("PATH"); + + if (!pathc) + return 0; + + const char *elem; + char *saveptr; + size_t len = strlen (pathc) + 1; + char path[len]; + strcpy (path, pathc); + + elem = strtok_r (path, ":", &saveptr); + while (elem) { + size_t n = strlen (elem) + strlen (prog) + 2; + char testprog[n]; + + snprintf (testprog, n, "%s/%s", elem, prog); + i...
2016 Jan 27
4
[PATCH] lvm: support lvm2 older than 2.02.107
...,lv_name + * removing thin layouts, and building the device path as we expect it. + * + * This is used only when lvm has no -S. + */ +static char ** +filter_convert_old_lvs_output (char *out) +{ + char *p, *pend; + DECLARE_STRINGSBUF (ret); + + p = out; + while (p) { + size_t len; + char *saveptr; + char *lv_attr, *vg_name, *lv_name; + + pend = strchr (p, '\n'); /* Get the next line of output. */ + if (pend) { + *pend = '\0'; + pend++; + } + + while (*p && c_isspace (*p)) /* Skip any leading whitespace. */ + p++; + + /* Sigh, skip tra...
2017 Mar 22
2
[PATCH] inspect: improve detection of Mageia install discs
...ttp://wiki.mandriva.com/en/Product_id (old URL, defunct) + */ +static int +check_product_id_installer_root (guestfs_h *g, struct inspect_fs *fs, + const char *filename) +{ + int64_t size; + CLEANUP_FREE_STRING_LIST char **lines = NULL; + const char *elem; + char *saveptr; + + fs->type = OS_TYPE_LINUX; + + /* Don't trust guestfs_head_n not to break with very large files. + * Check the file size is something reasonable first. + */ + size = guestfs_filesize (g, filename); + if (size == -1) + /* guestfs_filesize failed and has already set error in han...
2011 Nov 22
0
[PATCH] kinit: Add ability to mount filesystems via /etc/fstab or cmdline
...root_dev, const char *root_dev_name) return ret; } +int do_cmdline_mounts(int argc, char *argv[]) +{ + int arg_i; + + for (arg_i = 0; arg_i < argc; arg_i++) { + const char *fs_name, *fs_dir, *fs_type; + char *fs_opts; + unsigned long flags = 0; + char new_fs_opts[128] = { 0 }; + char *saveptr = NULL; + char *fs_opts_savedptr = NULL; + int opt_first = 1; + const char *opt; + + if (strncmp(argv[arg_i], "kinit_mount=", 12)) + continue; + /* + * Format: + * <fs_name>;<dir>;<fs_type>;[opt1],[optn...] + */ + fs_name = strtok_r(&argv[arg_i][12],...
2017 Mar 22
1
[PATCH v2] inspect: improve detection of Mageia install discs
...ageia.org/en/Product_id + * - http://wiki.mandriva.com/en/Product_id (old URL, defunct) + */ +static int +check_product_id_installer_root (guestfs_h *g, struct inspect_fs *fs, + const char *filename) +{ + CLEANUP_FREE char *line = NULL; + const char *elem; + char *saveptr; + + fs->type = OS_TYPE_LINUX; + + line = guestfs_int_first_line_of_file (g, filename); + if (line == NULL) + return -1; + + elem = strtok_r (line, ",", &saveptr); + while (elem) { + const char *equal = strchr (elem, '='); + if (equal == NULL || equal == elem)...
2019 Nov 26
0
[PATCH common v2 1/3] options: Simplify selector parsing for --key options.
..._store *ks, const char *device) } struct key_store * -key_store_add_from_selector (struct key_store *ks, const char *selector_orig) +key_store_add_from_selector (struct key_store *ks, const char *selector) { - CLEANUP_FREE char *selector = strdup (selector_orig); - const char *elem; - char *saveptr; + CLEANUP_FREE_STRING_LIST char **fields = + guestfs_int_split_string (':', selector); struct key_store_key key; - if (!selector) - error (EXIT_FAILURE, errno, "strdup"); + if (!fields) + error (EXIT_FAILURE, errno, "guestfs_int_split_string"); - /*...
2016 Jan 28
0
[PATCH v2] lvm: support lvm2 older than 2.02.107
...,lv_name + * removing thin layouts, and building the device path as we expect it. + * + * This is used only when lvm has no -S. + */ +static char ** +filter_convert_old_lvs_output (char *out) +{ + char *p, *pend; + DECLARE_STRINGSBUF (ret); + + p = out; + while (p) { + size_t len; + char *saveptr; + char *lv_attr, *vg_name, *lv_name; + + pend = strchr (p, '\n'); /* Get the next line of output. */ + if (pend) { + *pend = '\0'; + pend++; + } + + while (*p && c_isspace (*p)) /* Skip any leading whitespace. */ + p++; + + /* Sigh, skip tra...
2012 Mar 08
3
[PATCH 0/3] kinit: Allow mount options
This patch series allows user-specified mount commands to be sent in via kernel command line ("kinit_mount=...") or via an embedded /etc/fstab file. The first patch is a cleanup of a patch sent last November by San Mehat (http://web.archiveorange.com/archive/v/EazJNBMORV2U7E0coh5h); the next two are small improvements or bug fixes.
2015 Jun 23
0
Re: [PATCH] daemon: Rewrite prog_exists so it uses the actual PATH, not hard-coded list.
...t; sizeof dirs / sizeof dirs[0]; ++i) { > - snprintf (buf, sizeof buf, "%s/%s", dirs[i], prog); > - if (access (buf, X_OK) == 0) > + const char *pathc = getenv ("PATH"); > + > + if (!pathc) > + return 0; > + > + const char *elem; > + char *saveptr; > + size_t len = strlen (pathc) + 1; > + char path[len]; > + strcpy (path, pathc); > + > + elem = strtok_r (path, ":", &saveptr); > + while (elem) { > + size_t n = strlen (elem) + strlen (prog) + 2; > + char testprog[n]; > + > + snprintf (t...
2017 Mar 22
1
Re: [PATCH] inspect: improve detection of Mageia install discs
...int > > +check_product_id_installer_root (guestfs_h *g, struct inspect_fs *fs, > > + const char *filename) > > +{ > > + int64_t size; > > + CLEANUP_FREE_STRING_LIST char **lines = NULL; > > + const char *elem; > > + char *saveptr; > > + > > + fs->type = OS_TYPE_LINUX; > > + > > + /* Don't trust guestfs_head_n not to break with very large files. > > + * Check the file size is something reasonable first. > > + */ > > + size = guestfs_filesize (g, filename); > > +...
2019 Nov 12
0
[PATCH 2/2] options: Allow multiple --key parameters and default keys.
...r[0] = s; + } + + return r; } struct key_store * -key_store_add_from_selector (struct key_store *ks, const char *selector_orig) +key_store_add_from_selector (struct key_store *ks, const char *selector) { - CLEANUP_FREE char *selector = strdup (selector_orig); - const char *elem; - char *saveptr; + CLEANUP_FREE_STRING_LIST char **fields = + guestfs_int_split_string (':', selector); struct key_store_key key; - if (!selector) - error (EXIT_FAILURE, errno, "strdup"); + if (!fields) + error (EXIT_FAILURE, errno, "guestfs_int_split_string"); - /*...
2017 Mar 22
0
Re: [PATCH] inspect: improve detection of Mageia install discs
...L, defunct) > + */ > +static int > +check_product_id_installer_root (guestfs_h *g, struct inspect_fs *fs, > + const char *filename) > +{ > + int64_t size; > + CLEANUP_FREE_STRING_LIST char **lines = NULL; > + const char *elem; > + char *saveptr; > + > + fs->type = OS_TYPE_LINUX; > + > + /* Don't trust guestfs_head_n not to break with very large files. > + * Check the file size is something reasonable first. > + */ > + size = guestfs_filesize (g, filename); > + if (size == -1) > + /* guestfs_fil...
2008 Sep 07
1
[git pull v2] initial mntent.h, mount features, ipconfig fixes
.../dev/null +++ b/usr/klibc/getmntent.c @@ -0,0 +1,61 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <mntent.h> + +#define BUFLEN 1024 + +struct mntent *getmntent_r(FILE *fp, struct mntent *mntbuf, char *buf, + int buflen) +{ + char *line = NULL, *saveptr = NULL; + const char *sep = " \t\n"; + + if (!fp || !mntbuf || !buf) + return NULL; + + while ((line = fgets(buf, buflen, fp)) != NULL) { + if (buf[0] == '#' || buf[0] == '\n') + continue; + break; + } + + if (!line) + return NULL; + + mntbuf->mnt_fsname = strtok_...
2017 Jul 14
0
[PATCH 14/27] daemon: Reimplement ‘lvs’ API in OCaml.
...in layouts, and building the device path as we expect it. - * - * This is used only when lvm has no -S. - */ -static char ** -filter_convert_old_lvs_output (char *out) -{ - char *p, *pend; - CLEANUP_FREE_STRINGSBUF DECLARE_STRINGSBUF (ret); - - p = out; - while (p) { - size_t len; - char *saveptr; - char *lv_attr, *vg_name, *lv_name; - - pend = strchr (p, '\n'); /* Get the next line of output. */ - if (pend) { - *pend = '\0'; - pend++; - } - - while (*p && c_isspace (*p)) /* Skip any leading whitespace. */ - p++; - - /* Sigh, skip tra...
2011 Aug 03
1
[PATCH v2] kinit: Add drop_capabilities support.
...cap_ordinal); +} + +static void drop_capability(int cap_ordinal) +{ + do_usermodehelper(cap_ordinal); + do_bset(cap_ordinal); + do_capset(cap_ordinal); + + printf("Dropped capability: %s\n", capabilities[cap_ordinal].cap_name); +} + +int drop_capabilities(const char *caps) +{ + char *s, *saveptr = NULL; + char *token; + int drop_setpcap = 0; + + if (!caps) + return 0; + + /* Create a duplicate string that can be modified. */ + s = strdup(caps); + if (!s) + fail("Failed to drop caps as requested. Exiting\n"); + + token = strtok_r(s, ",", &saveptr); + while (token)...
2019 Nov 12
4
[PATCH 1/2] options: Fixes and enhancements to --key parsing.
The first patch fixes a rather serious bug, the second patch allows multiple --key parameters and default parameters. There is a third patch to libguestfs which adds a test, coming up. I did not yet review and fix the documentation. I think we need to centralize it in one place because at the moment the same documentation for --key is copy/pasted all over the tools. Rich.
2019 Nov 26
6
[PATCH options v2 0/3] options: Allow multiple and default --key parameters.
v1: https://www.redhat.com/archives/libguestfs/2019-November/msg00036.html
2017 Jan 12
3
[PATCH 0/3] library: improve handling of external tools
Hi, the libguestfs library uses a number of external tools; for some of them, we search for them at build time, enabling some feature only if found, and later on assuming at runtime they are installed. However, the situation is more complex than that: - hardcoding the full path means that there is an incoherency in the way some of the tools are used, as some other tools (e.g. qemu-img) are
2013 Sep 06
21
[PATCH v2 0/5] xl: allow for node-wise specification of vcpu pinning
Hi all, This is the second take of a patch that I submitted some time ago for allowing specifying vcpu pinning taking NUMA nodes into account. IOW, something like this: * "nodes:0-3": all pCPUs of nodes 0,1,2,3;  * "nodes:0-3,^node:2": all pCPUS of nodes 0,1,3;  * "1,nodes:1-2,^6": pCPU 1 plus all pCPUs of nodes 1,2    but not pCPU 6; v1 was a single patch, this is
2017 Feb 02
4
[PATCH v2 0/3] library: improve handling of external tools
Hi, the libguestfs library uses a number of external tools; for some of them, we search for them at build time, enabling some feature only if found, and later on assuming at runtime they are installed. However, the situation is more complex than that: - hardcoding the full path means that there is an incoherency in the way some of the tools are used, as some other tools (e.g. qemu-img) are