search for: streqlen

Displaying 20 results from an estimated 64 matches for "streqlen".

2017 Jan 19
3
[PATCH 1/2] daemon: Fix part-to-dev when the partition name includes p<N>.
From: Pino Toscano <ptoscano@redhat.com> If the device name ends with a number, Linux uses partition names of the form <device>p<N>. Handle this case by knocking off the 'p' character. --- daemon/devsparts.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/daemon/devsparts.c b/daemon/devsparts.c index 5862ae2..b764f63 100644 --- a/daemon/devsparts.c +++
2017 Jan 19
0
[PATCH 2/2] daemon: Return MD partitions in guestfs_list_partitions (RHBZ#1414510).
...for each discovered block device */ static char ** -foreach_block_device (block_dev_func_t func) +foreach_block_device (block_dev_func_t func, bool return_md) { CLEANUP_FREE_STRINGSBUF DECLARE_STRINGSBUF (r); DIR *dir; @@ -60,7 +61,9 @@ foreach_block_device (block_dev_func_t func) STREQLEN (d->d_name, "hd", 2) || STREQLEN (d->d_name, "ubd", 3) || STREQLEN (d->d_name, "vd", 2) || - STREQLEN (d->d_name, "sr", 2)) { + STREQLEN (d->d_name, "sr", 2) || + (return_md && +...
2009 Nov 09
1
use STREQ(a,b), not strcmp(a,b) == 0
The series below makes changes like these mechanically, one class of change per change-set: strcmp(...) == 0 to STREQ(...) strcmp(...) != 0 to STRNEQ(...) strncmp(...) == 0 to STREQLEN(...) strncmp(...) != 0 to STRNEQLEN(...) strcasecmp(...) == 0 to STRCASEEQ(...) strcasecmp(...) != 0 to STRCASENEQ(...) strncasecmp(...) == 0 to STRCASEEQLEN(...) strncasecmp(...) != 0 to STRCASENEQLEN(...) Then it enables the "make syntax-check" tests to ensure no...
2017 Feb 14
0
[PATCH 2/2] GCC 7: Allocate sufficient space for sprintf output.
....c @@ -43,7 +43,6 @@ foreach_block_device (block_dev_func_t func, bool return_md) DIR *dir; int err = 0; struct dirent *d; - char dev_path[256]; int fd; dir = opendir ("/sys/block"); @@ -64,7 +63,12 @@ foreach_block_device (block_dev_func_t func, bool return_md) STREQLEN (d->d_name, "sr", 2) || (return_md && STREQLEN (d->d_name, "md", 2) && c_isdigit (d->d_name[2]))) { - snprintf (dev_path, sizeof dev_path, "/dev/%s", d->d_name); + CLEANUP_FREE char *dev_path; + if (asprintf...
2017 Feb 14
0
[PATCH v2 2/2] GCC 7: Allocate sufficient space for sprintf output.
....c @@ -43,7 +43,6 @@ foreach_block_device (block_dev_func_t func, bool return_md) DIR *dir; int err = 0; struct dirent *d; - char dev_path[256]; int fd; dir = opendir ("/sys/block"); @@ -64,7 +63,12 @@ foreach_block_device (block_dev_func_t func, bool return_md) STREQLEN (d->d_name, "sr", 2) || (return_md && STREQLEN (d->d_name, "md", 2) && c_isdigit (d->d_name[2]))) { - snprintf (dev_path, sizeof dev_path, "/dev/%s", d->d_name); + CLEANUP_FREE char *dev_path; + if (asprintf...
2017 Feb 14
4
[PATCH v2 0/2] GCC 7: Misc fixes
v1 -> v2: - Use intprops macro suggested by danpb. Rich.
2017 Feb 14
2
[PATCH 1/2] GCC 7: Add __attribute__((noreturn)) to some usage functions which call exit.
This happens with GCC 7.0.1. The errors were all of the form: qemu-speed-test.c: In function 'main': qemu-speed-test.c:153:7: error: this statement may fall through [-Werror=implicit-fallthrough=] usage (EXIT_SUCCESS); ^~~~~~~~~~~~~~~~~~~~ qemu-speed-test.c:155:5: note: here default: ^~~~~~~ --- builder/index-validate.c | 2 +-
2014 Aug 07
4
[PATCH 0/2] Fix errors found by Clang static analyzer
Hi, Here is one trivial initialization fix and another patch to convert a huge macro to an inline function. The result of the expansion would show up in an assertion which triggered a -Woverlength-strings warning. Peter Wu (2): Fix garbage return value on error Fix overly long assertion string lib/hivex-internal.h | 28 ++++++++++++++++------------ lib/node.c | 18
2015 Jun 16
2
[PATCH] New API: btrfs_device_stats
..._btrfs_subvolume_show (const char *subvolume) } /* Read the lines and split into "key: value". */ - p = analyze_line(p, &key, &value); + p = analyze_line(p, &key, &value, ':'); while (key) { /* snapshot is special, see the output above */ if (STREQLEN (key, "Snapshot(s)", sizeof ("Snapshot(s)") - 1)) { @@ -994,7 +994,7 @@ do_btrfs_subvolume_show (const char *subvolume) if (add_string (&ret, key) == -1) return NULL; - p = analyze_line(p, &key, &value); + p = analyze_line(p, &key, &am...
2017 Jul 14
0
[PATCH 05/27] daemon: Reimplement several devsparts APIs in OCaml.
...GSBUF (r); - DIR *dir; - int err = 0; - struct dirent *d; - int fd; - - dir = opendir ("/sys/block"); - if (!dir) { - reply_with_perror ("opendir: /sys/block"); - return NULL; - } - - for (;;) { - errno = 0; - d = readdir (dir); - if (!d) break; - - if (STREQLEN (d->d_name, "sd", 2) || - STREQLEN (d->d_name, "hd", 2) || - STREQLEN (d->d_name, "ubd", 3) || - STREQLEN (d->d_name, "vd", 2) || - STREQLEN (d->d_name, "sr", 2) || - (return_md && -...
2015 Jun 17
3
[PATCH v2 1/2] Modify public function: analyze_line, make it more flexible
..._btrfs_subvolume_show (const char *subvolume) } /* Read the lines and split into "key: value". */ - p = analyze_line(p, &key, &value); + p = analyze_line(p, &key, &value, ':'); while (key) { /* snapshot is special, see the output above */ if (STREQLEN (key, "Snapshot(s)", sizeof ("Snapshot(s)") - 1)) { @@ -994,7 +993,7 @@ do_btrfs_subvolume_show (const char *subvolume) if (add_string (&ret, key) == -1) return NULL; - p = analyze_line(p, &key, &value); + p = analyze_line(p, &key, &am...
2017 Aug 03
0
[PATCH 3/6] daemon: Refine check for Device and Dev_or_Path parameters (RHBZ#1477623).
...just return the * file type as a string (RHBZ#582484). diff --git a/daemon/mount.c b/daemon/mount.c index bf58bd527..61ce64449 100644 --- a/daemon/mount.c +++ b/daemon/mount.c @@ -120,7 +120,7 @@ do_umount (const char *pathordevice, const char *argv[MAX_ARGS]; size_t i = 0; - is_dev = STREQLEN (pathordevice, "/dev/", 5); + is_dev = is_device_parameter (pathordevice); buf = is_dev ? strdup (pathordevice) : sysroot_path (pathordevice); if (buf == NULL) { diff --git a/daemon/stubs-macros.h b/daemon/stubs-macros.h index e9da16227..2a90938c6 100644 --- a/daemon/stubs-mac...
2010 Feb 05
1
-Woverlength-strings / assert unhelpful interaction
.../MinGW http://www.annexia.org/fedora_mingw -------------- next part -------------- #include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> struct hive_h { void *addr; }; struct ntreg_hbin_block { char id[2]; }; typedef size_t hive_node_h; #define STREQLEN(a,b,n) (strncmp((a),(b),(n)) == 0) #define BLOCK_ID_EQ(h,offs,eqid) \ (STREQLEN (((struct ntreg_hbin_block *)((h)->addr + (offs)))->id, (eqid), 2)) static size_t insert_lf_record (struct hive_h *h, size_t old_offs, size_t posn, const char *name, hive_node_h node) { asse...
2015 Jun 19
2
[PATCH v2 1/2] Modify the function: analyze_line, make it more flexible
..._btrfs_subvolume_show (const char *subvolume) } /* Read the lines and split into "key: value". */ - p = analyze_line(p, &key, &value); + p = analyze_line(p, &key, &value, ':'); while (key) { /* snapshot is special, see the output above */ if (STREQLEN (key, "Snapshot(s)", sizeof ("Snapshot(s)") - 1)) { @@ -994,7 +993,7 @@ do_btrfs_subvolume_show (const char *subvolume) if (add_string (&ret, key) == -1) return NULL; - p = analyze_line(p, &key, &value); + p = analyze_line(p, &key, &am...
2015 Jun 19
3
[PATCH v3 1/2] Modify the function: analyze_line, make it more flexible
..._btrfs_subvolume_show (const char *subvolume) } /* Read the lines and split into "key: value". */ - p = analyze_line(p, &key, &value); + p = analyze_line(p, &key, &value, ':'); while (key) { /* snapshot is special, see the output above */ if (STREQLEN (key, "Snapshot(s)", sizeof ("Snapshot(s)") - 1)) { @@ -994,7 +993,7 @@ do_btrfs_subvolume_show (const char *subvolume) if (add_string (&ret, key) == -1) return NULL; - p = analyze_line(p, &key, &value); + p = analyze_line(p, &key, &am...
2015 Jun 23
1
[PATCH] Modify the function: analyze_line, make it more flexible
..._btrfs_subvolume_show (const char *subvolume) } /* Read the lines and split into "key: value". */ - p = analyze_line(p, &key, &value); + p = analyze_line(p, &key, &value, ':'); while (key) { /* snapshot is special, see the output above */ if (STREQLEN (key, "Snapshot(s)", sizeof ("Snapshot(s)") - 1)) { @@ -994,7 +993,7 @@ do_btrfs_subvolume_show (const char *subvolume) if (add_string (&ret, key) == -1) return NULL; - p = analyze_line(p, &key, &value); + p = analyze_line(p, &key, &am...
2015 Oct 15
1
[PATCH v2] inspect: check for errors in files parsed with augeas (RHBZ#1229119)
...matches; *match != NULL; ++match) { + for (i = 0; configfiles[i] != NULL; ++i) { + len = strlen (configfiles[i]); + if (strlen (*match) == (13 /* len(/augeas/files) */ + len + 6 /* len(/error) */) && + STRPREFIX(*match, "/augeas/files") && + STREQLEN(*match + 13, configfiles[i], len) && + STREQ(*match + 13 + len, "/error")) { + error (g, _("augeas could not parse %s"), configfiles[i]); + goto out; + } + } + } + r = f (g, fs); out: -- 2.1.0
2012 Jul 24
3
[PATCH V4 1/3] umount: add force umount and lazy umount
...* is kept updated. */ int -do_umount (const char *pathordevice) +do_umount (const char *pathordevice, + int force, int lazyunmount) { int r; char *err; char *buf; int is_dev; + char prog[] = "umount"; + const char *argv[MAX_ARGS]; + size_t i = 0; is_dev = STREQLEN (pathordevice, "/dev/", 5); buf = is_dev ? strdup (pathordevice) @@ -205,7 +211,22 @@ do_umount (const char *pathordevice) if (is_dev) RESOLVE_DEVICE (buf, , { free (buf); return -1; }); - r = command (NULL, &err, "umount", buf, NULL); + if (!(optargs_bitmask...
2015 Jun 16
0
Re: [PATCH] New API: btrfs_device_stats
...lume) > } > > /* Read the lines and split into "key: value". */ > - p = analyze_line(p, &key, &value); > + p = analyze_line(p, &key, &value, ':'); > while (key) { > /* snapshot is special, see the output above */ > if (STREQLEN (key, "Snapshot(s)", sizeof ("Snapshot(s)") - 1)) { > @@ -994,7 +994,7 @@ do_btrfs_subvolume_show (const char *subvolume) > if (add_string (&ret, key) == -1) > return NULL; > > - p = analyze_line(p, &key, &value); > + p =...
2015 Oct 16
1
[PATCH] inspect: Include more information for augeas parse errors (RHBZ#1229119)
...matches; *match != NULL; ++match) { for (i = 0; configfiles[i] != NULL; ++i) { - len = strlen (configfiles[i]); - if (strlen (*match) == (13 /* len(/augeas/files) */ + len + 6 /* len(/error) */) && - STRPREFIX(*match, "/augeas/files") && - STREQLEN(*match + 13, configfiles[i], len) && - STREQ(*match + 13 + len, "/error")) { - error (g, _("augeas could not parse %s"), configfiles[i]); + CLEANUP_FREE char *errorpath = + safe_asprintf (g, "/augeas/files%s/error", configfiles[i]);...