search for: strprefix

Displaying 20 results from an estimated 238 matches for "strprefix".

2017 Mar 17
1
[PATCH] btrfs_filesystem_show: work with another old btrfs version
...bbea6fe40091ebc2b7f0. --- daemon/btrfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/daemon/btrfs.c b/daemon/btrfs.c index d18f518..23513a9 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -2268,7 +2268,8 @@ do_btrfs_filesystem_show (const char *device) } else if (STRPREFIX (lines[i], "\t*** Some devices missing")) { reply_with_error_errno (ENODEV, "%s: missing devices", device); return NULL; - } else if (STRPREFIX (lines[i], "btrfs-progs v")) { + } else if (STRPREFIX (lines[i], "btrfs-progs v") || +...
2017 Feb 22
1
[PATCH] inspect: ignore /dev/cdN devices in /etc/fstab
...fs-unix.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/inspect-fs-unix.c b/lib/inspect-fs-unix.c index 7e940d6..9b6bfbf 100644 --- a/lib/inspect-fs-unix.c +++ b/lib/inspect-fs-unix.c @@ -1305,6 +1305,7 @@ check_fstab (guestfs_h *g, struct inspect_fs *fs) * discs. */ if ((STRPREFIX (spec, "/dev/fd") && c_isdigit (spec[7])) || + (STRPREFIX (spec, "/dev/cd") && c_isdigit (spec[7])) || STREQ (spec, "/dev/floppy") || STREQ (spec, "/dev/cdrom") || STRPREFIX (spec, "/dev/iso9660/"))...
2017 Aug 03
0
[PATCH 3/6] daemon: Refine check for Device and Dev_or_Path parameters (RHBZ#1477623).
...used_result__)); extern int xread (int sock, void *buf, size_t len) diff --git a/daemon/dd.c b/daemon/dd.c index 15f3f7a6c..0b61c87d8 100644 --- a/daemon/dd.c +++ b/daemon/dd.c @@ -35,7 +35,7 @@ do_dd (const char *src, const char *dest) CLEANUP_FREE char *err = NULL; int r; - src_is_dev = STRPREFIX (src, "/dev/"); + src_is_dev = is_device_parameter (src); if (src_is_dev) r = asprintf (&if_arg, "if=%s", src); @@ -46,7 +46,7 @@ do_dd (const char *src, const char *dest) return -1; } - dest_is_dev = STRPREFIX (dest, "/dev/"); + dest_is_dev...
2015 Oct 22
1
[PATCH] Bugfix in number parsing in vfs_min_size.
...2 +- daemon/ntfs.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/daemon/ext2.c b/daemon/ext2.c index 342d217..6543574 100644 --- a/daemon/ext2.c +++ b/daemon/ext2.c @@ -336,7 +336,7 @@ ext_minimum_size (const char *device) for (i = 0; lines[i] != NULL; ++i) { if (STRPREFIX (lines[i], pattern)) { if (XSTRTOD64 (lines[i] + strlen (pattern), - NULL, 20, &ret, NULL) != LONGINT_OK) { + NULL, 10, &ret, NULL) != LONGINT_OK) { reply_with_error ("cannot parse minimum size"); return -1; }...
2015 Mar 16
0
[PATCH] inspection: add support for systemd .mount files
...What/value", *entry); + spec = guestfs_aug_get (g, augpath); + if (spec == NULL) + return -1; + + /* Ignore /dev/fd (floppy disks) (RHBZ#642929) and CD-ROM drives. + * + * /dev/iso9660/FREEBSD_INSTALL can be found in FreeBSDs installation + * discs. + */ + if ((STRPREFIX (spec, "/dev/fd") && c_isdigit (spec[7])) || + STREQ (spec, "/dev/floppy") || + STREQ (spec, "/dev/cdrom") || + STRPREFIX (spec, "/dev/iso9660/")) + continue; + + snprintf (augpath, sizeof augpath, "%s/Mount/Where/val...
2015 Mar 16
2
[PATCH] RFE: Inspection should support systemd mount units
Adds support for systemd .mount files, uses Augeas to extract mount points. Fixes RHBZ#1113153. Maros Zatko (1): inspection: add support for systemd .mount files src/inspect-fs-unix.c | 240 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 240 insertions(+) -- 1.9.3
2015 Mar 17
4
[PATCH] New API: part_get_part_type for showing partition type
...*/ + CLEANUP_FREE char *out = print_partition_table (device, PARTED_NO_M); + if (!out) + return NULL; + + CLEANUP_FREE_STRING_LIST char **lines = split_lines (out); + + if (!lines) + return NULL; + + size_t start = 0, end = 0, row; + + for (row = 0; lines[row] != NULL; ++row) + if (STRPREFIX (lines[row], "Number")) { + start = row + 1; + break; + } + + if (start == 0) { + reply_with_error ("parted output has no \"Number\" line"); + return NULL; + } + + for (row = start; lines[row] != NULL; ++row) + if (STREQ (lines[row], "&quo...
2017 Mar 22
1
[PATCH v2] inspect: improve detection of Mageia install discs
...ne_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) + return -1; + + const char *value = equal + 1; + + if (STRPREFIX (elem, "distribution=")) { + if (STREQ (value, "Mageia")) + fs->distro = OS_DISTRO_MAGEIA; + } else if (STRPREFIX (elem, "version=")) { + if (guestfs_int_version_from_x_y_or_x (g, &fs->version, value) == -1) + return -1; + } else...
2015 Mar 13
2
[PATCH] part-list: add support for show partition type
...- if (r == NULL) { - reply_with_perror ("malloc"); - return NULL; + /* Old-style. Start at the line following "^Number", up to the + * next blank line. + */ + size_t start = 0, end = 0, has_type = 0, row; + + for (row = 0; lines[row] != NULL; ++row) + if (STRPREFIX (lines[row], "Number")) { + start = row+1; + /* check whether output of parted has 'Type' field */ + if (strstr (lines[row], "Type")) + has_type = 1; + break; } - r->guestfs_int_partition_list_len = nr_rows; - r->guestfs_int_partitio...
2016 May 16
1
[PATCH] btrfs_filesystem_show: work with btrfs < 4.3.1
...hat btrfs_filesystem_show needs. --- daemon/btrfs.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/daemon/btrfs.c b/daemon/btrfs.c index 62bdac7..9b52aa8 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -2270,6 +2270,12 @@ do_btrfs_filesystem_show (const char *device) } else if (STRPREFIX (lines[i], "\t*** Some devices missing")) { reply_with_error_errno (ENODEV, "%s: missing devices", device); return NULL; + } else if (STRPREFIX (lines[i], "btrfs-progs v")) { + /* Older versions of btrfs-progs output also the version string +...
2018 Feb 07
1
[PATCH] tmpdirs: Make the ‘su broken’ error message actionable.
...stfs_h *g), int is_runtime_dir, + char **dest) { if (!*dest) { CLEANUP_FREE char *tmpdir = getdir (g); char *tmppath = safe_asprintf (g, "%s/libguestfsXXXXXX", tmpdir); if (mkdtemp (tmppath) == NULL) { - int bad_systemd = errno == EACCES && STRPREFIX (tmpdir, "/run/user/"); + int bad_systemd = is_runtime_dir && errno == EACCES && + STRPREFIX (tmpdir, "/run/user/"); if (!bad_systemd) perrorf (g, _("%s: cannot create temporary directory"), tmppath); else - e...
2020 Sep 17
1
Re: [PATCH v2 7/7] lib/canonical-name.c: Hide errors.
...etion(-) > > diff --git a/lib/canonical-name.c b/lib/canonical-name.c > index 052bbf12c..11cf6fed6 100644 > --- a/lib/canonical-name.c > +++ b/lib/canonical-name.c > @@ -46,8 +46,9 @@ guestfs_impl_canonical_device_name (guestfs_h *g, const char *device) > } > else if (STRPREFIX (device, "/dev/mapper/") || > STRPREFIX (device, "/dev/dm-")) { > - /* XXX hide errors */ > + guestfs_push_error_handler (g, NULL, NULL); > ret = guestfs_lvm_canonical_lv_name (g, device); > + guestfs_pop_error_handler (g); Instead of ig...
2015 Sep 09
2
[PATCH] inspect: try to use /etc/os-release on Linux guests
...ntinue; + + ++value; + value_len = strlen (line) - (value - line); + if (value_len > 1 && value[0] == '"' && value[value_len-1] == '"') { + ++value; + value_len -= 2; + } + +#define VALUE_IS(a) STREQLEN(value, a, value_len) + if (STRPREFIX (line, "ID=")) { + if (VALUE_IS ("alpine")) + distro = OS_DISTRO_ALPINE_LINUX; + else if (VALUE_IS ("altlinux")) + distro = OS_DISTRO_ALTLINUX; + else if (VALUE_IS ("arch")) + distro = OS_DISTRO_ARCHLINUX; + else if (V...
2014 Nov 17
1
[PATCH] inspection: deb: Seperate epoch field from version
...truct inspect_fs *fs) FILE *fp; char line[1024]; size_t len; + int32_t epoch = 0; CLEANUP_FREE char *name = NULL, *version = NULL, *release = NULL, *arch = NULL; int installed_flag = 0; @@ -482,23 +483,31 @@ list_applications_deb (guestfs_h *g, struct inspect_fs *fs) else if (STRPREFIX (line, "Version: ")) { free (version); free (release); - char *p = strchr (&line[9], '-'); - if (p) { - *p = '\0'; - version = safe_strdup (g, &line[9]); - release = safe_strdup (g, p+1); + char *p1, *p2; + p1...
2017 Mar 22
2
[PATCH] inspect: improve detection of Mageia install discs
..._n (g, 1, filename); + if (lines == NULL) + return -1; + + elem = strtok_r (lines[0], ",", &saveptr); + while (elem) { + const char *equal = strchr (elem, '='); + if (equal == NULL || equal == elem) + return -1; + + const char *value = equal + 1; + + if (STRPREFIX (elem, "distribution=")) { + if (STREQ (value, "Mageia")) + fs->distro = OS_DISTRO_MAGEIA; + } else if (STRPREFIX (elem, "version=")) { + if (guestfs_int_version_from_x_y_or_x (g, &fs->version, value) == -1) + return -1; + } else...
2015 Mar 13
0
Re: [PATCH] part-list: add support for show partition type
...perror ("malloc"); > - return NULL; > + /* Old-style. Start at the line following "^Number", up to the > + * next blank line. > + */ > + size_t start = 0, end = 0, has_type = 0, row; > + > + for (row = 0; lines[row] != NULL; ++row) > + if (STRPREFIX (lines[row], "Number")) { > + start = row+1; > + /* check whether output of parted has 'Type' field */ > + if (strstr (lines[row], "Type")) > + has_type = 1; > + break; > } > - r->guestfs_int_partition_list_len = nr_ro...
2015 Mar 23
0
Re: [PATCH] New API: part_get_part_type for showing partition type
...ce, PARTED_NO_M); > + if (!out) > + return NULL; > + > + CLEANUP_FREE_STRING_LIST char **lines = split_lines (out); > + > + if (!lines) > + return NULL; > + > + size_t start = 0, end = 0, row; > + > + for (row = 0; lines[row] != NULL; ++row) > + if (STRPREFIX (lines[row], "Number")) { > + start = row + 1; > + break; > + } > + > + if (start == 0) { > + reply_with_error ("parted output has no \"Number\" line"); > + return NULL; > + } > + > + for (row = start; lines[row] != N...
2016 May 12
1
[PATCH] New API: btrfs-filesystem-show (RHBZ#1164765)
...1-7d7685970a6c + * Total devices 3 FS bytes used 1.12MiB + * devid 1 size 10.00GiB used 2.00GiB path /dev/sda + * [...] + * *** Some devices missing + */ + for (i = 1; lines[i] != NULL; ++i) { + if (lines[i][0] == 0) + continue; + if (STRPREFIX (lines[i], "Label: ")) + continue; + else if (STRPREFIX (lines[i], "\tTotal devices ")) + continue; + else if (STRPREFIX (lines[i], "\tdevid ")) { + const char *p = strstr (lines[i], " path "); + const char *end; + if (!p) +...
2013 Feb 12
7
Remaining btrfs patches
[PATCH 1/7] mount: Add mount_vfs_nochroot This is significantly reworked from before. umount is gone as discussed, and variable motion is minimised. [PATCH 2/7] btrfs: Update btrfs_subvolume_list to take Already provisionally ACKed. Previous comment was that cleanup could be tidier. I looked into creating a new cleanup function for fs_buf, but it isn't possible (or simple, anyway) in this
2015 Mar 24
1
[PATCH 2/2] New API: part_get_part_type for showing partition type
...+ CLEANUP_FREE char *out = print_partition_table (device, PARTED_OPT_NO_M); + if (!out) + return NULL; + + CLEANUP_FREE_STRING_LIST char **lines = split_lines (out); + + if (!lines) + return NULL; + + size_t start = 0, end = 0, row; + + for (row = 0; lines[row] != NULL; ++row) + if (STRPREFIX (lines[row], "Number")) { + start = row + 1; + break; + } + + if (start == 0) { + reply_with_error ("parted output has no \"Number\" line"); + return NULL; + } + + for (row = start; lines[row] != NULL; ++row) + if (STREQ (lines[row], "&quo...