search for: scni64

Displaying 20 results from an estimated 56 matches for "scni64".

2020 May 22
1
Re: [PATCH nbdkit] DDRESCUE: MISC FIXES
...Use vector type to store map ranges. > > Test filenames unique. > > Remove some unused variables. > > Break up long lines. > --- > @@ -95,7 +95,8 @@ parse_mapfile (const char *filename) > continue; > } > > - if (sscanf (line, "%" SCNi64 "\t%" SCNi64 "\t%c", &offset, &length, &status) == 3) { > + if (sscanf (line, "%" SCNi64 "\t%" SCNi64 "\t%c", > + &offset, &length, &status) == 3) { sscanf() cannot detect integer overflow. If you ca...
2015 Mar 13
2
[PATCH] part-list: add support for show partition type
...LL; + } + + for (row = start; lines[row] != NULL; ++row) + if (STREQ (lines[row], "")) { + end = row; + break; } - /* Now parse the lines. */ - size_t i; - for (i = 0, row = 2; lines[row] != NULL; ++i, ++row) { - if (sscanf (lines[row], "%d:%" SCNi64 "B:%" SCNi64 "B:%" SCNi64 "B", + if (end == 0) { + reply_with_error ("parted output has no blank after end of table"); + return NULL; + } + + size_t nr_rows = end - start; + + r = malloc (sizeof *r); + if (r == NULL) { + reply_with_perror (&quot...
2015 Mar 13
0
Re: [PATCH] part-list: add support for show partition type
...NULL; ++row) > + if (STREQ (lines[row], "")) { > + end = row; > + break; > } > > - /* Now parse the lines. */ > - size_t i; > - for (i = 0, row = 2; lines[row] != NULL; ++i, ++row) { > - if (sscanf (lines[row], "%d:%" SCNi64 "B:%" SCNi64 "B:%" SCNi64 "B", > + if (end == 0) { > + reply_with_error ("parted output has no blank after end of table"); > + return NULL; > + } > + > + size_t nr_rows = end - start; > + > + r = malloc (sizeof *r); > + i...
2020 May 22
3
[PATCH nbdkit] ddrescue: Miscellaneous fixes.
A few fixes and a possible enhancement to the ddrescue filter. If you think these are all OK, I will squash it into your patch and push it. Rich.
2015 Mar 24
1
[PATCH 2/2] New API: part_get_part_type for showing partition type
...4_t temp_int64; + int part_num; + char temp_type[16] = {'\0'}; + for (i = 0, row = start; row < end; ++i, ++row) { + if (STREQ (parttype, "gpt")) { + memcpy (temp_type, "primary", strlen("primary")); + if (sscanf (lines[row], "%d%" SCNi64 "B%" SCNi64 "B%" SCNi64 "B", + &part_num, + &temp_int64, + &temp_int64, + &temp_int64) != 4) { + reply_with_error ("could not parse row from output of parted print command: %s", li...
2018 Jan 28
0
[PATCH v3 1/3] daemon: Reimplement 'part_get_mbr_part_type' API in OCaml.
..._t temp_int64; - int part_num; - char temp_type[16] = {'\0'}; - for (i = 0, row = start; row < end; ++i, ++row) { - if (STREQ (parttype, "gpt")) { - memcpy (temp_type, "primary", strlen ("primary")); - if (sscanf (lines[row], "%d%" SCNi64 "B%" SCNi64 "B%" SCNi64 "B", - &part_num, - &temp_int64, - &temp_int64, - &temp_int64) != 4) { - reply_with_error ("could not parse row from output of parted print command: %s", lines[row]); - return NULL; - } -...
2015 Mar 17
4
[PATCH] New API: part_get_part_type for showing partition type
...error ("parted output has no blank after end of table"); + return NULL; + } + + /* Now parse the lines. */ + size_t i; + int64_t temp_int64; + int part_num; + char temp_type[16]; + for (i = 0, row = start; row < end; ++i, ++row) { + if (sscanf (lines[row], "%d%" SCNi64 "B%" SCNi64 "B%" SCNi64 "B" "%s", + &part_num, + &temp_int64, + &temp_int64, + &temp_int64, + temp_type) != 5) { + reply_with_error ("could not parse row from...
2015 Mar 24
4
[PATCH 0/2] New API: part_get_part_type
Chen Hanxiao (2): parted: introduce enum for whether parted has option -m New API: part_get_part_type for showing partition type daemon/parted.c | 136 ++++++++++++++++++++++++++++++++++++++++++++++----- generator/actions.ml | 18 +++++++ src/MAX_PROC_NR | 2 +- 3 files changed, 143 insertions(+), 13 deletions(-) -- 2.1.0
2020 May 22
0
[PATCH nbdkit] DDRESCUE: MISC FIXES
...} while ((len = getline (&line, &linelen, fp)) != -1) { - const char *delim = " \t"; - char *sp, *p; int64_t offset, length; char status; @@ -95,7 +95,8 @@ parse_mapfile (const char *filename) continue; } - if (sscanf (line, "%" SCNi64 "\t%" SCNi64 "\t%c", &offset, &length, &status) == 3) { + if (sscanf (line, "%" SCNi64 "\t%" SCNi64 "\t%c", + &offset, &length, &status) == 3) { if (offset < 0) { nbdkit_error ("block...
2018 Jan 28
9
guestfs_list_filesystems: skip block devices which cannot hold file system
Initial discussion is here: https://www.redhat.com/archives/libguestfs/2018-January/msg00188.html. v2 was posted here: https://www.redhat.com/archives/libguestfs/2018-January/msg00246.html. v3 comparing to v2 is just a rebase with slightly changed commits comments.
2018 Jan 25
2
[PATCH v2 1/3] daemon: Reimplement 'part_get_mbr_part_type' API in OCaml.
..._t temp_int64; - int part_num; - char temp_type[16] = {'\0'}; - for (i = 0, row = start; row < end; ++i, ++row) { - if (STREQ (parttype, "gpt")) { - memcpy (temp_type, "primary", strlen ("primary")); - if (sscanf (lines[row], "%d%" SCNi64 "B%" SCNi64 "B%" SCNi64 "B", - &part_num, - &temp_int64, - &temp_int64, - &temp_int64) != 4) { - reply_with_error ("could not parse row from output of parted print command: %s", lines[row]); - return NULL; - } -...
2015 Oct 05
2
[PATCH] Remove multiple hacks that only apply to RHEL 5.
...artition)); - if (r->guestfs_int_partition_list_val == NULL) { - reply_with_perror ("malloc"); - goto error2; - } - - /* Now parse the lines. */ - size_t i; - for (i = 0, row = 2; lines[row] != NULL; ++i, ++row) { - if (sscanf (lines[row], "%d:%" SCNi64 "B:%" SCNi64 "B:%" SCNi64 "B", - &r->guestfs_int_partition_list_val[i].part_num, - &r->guestfs_int_partition_list_val[i].part_start, - &r->guestfs_int_partition_list_val[i].part_end, -...
2017 Jul 14
0
[PATCH 20/27] daemon: Reimplement ‘part_list’ API in OCaml.
...f (guestfs_int_partition)); - if (r->guestfs_int_partition_list_val == NULL) { - reply_with_perror ("malloc"); - goto error2; - } - - /* Now parse the lines. */ - size_t i; - for (i = 0, row = 2; lines[row] != NULL; ++i, ++row) { - if (sscanf (lines[row], "%d:%" SCNi64 "B:%" SCNi64 "B:%" SCNi64 "B", - &r->guestfs_int_partition_list_val[i].part_num, - &r->guestfs_int_partition_list_val[i].part_start, - &r->guestfs_int_partition_list_val[i].part_end, - &am...
2015 Mar 23
0
Re: [PATCH] New API: part_get_part_type for showing partition type
...of table"); > + return NULL; > + } > + > + /* Now parse the lines. */ > + size_t i; > + int64_t temp_int64; > + int part_num; > + char temp_type[16]; > + for (i = 0, row = start; row < end; ++i, ++row) { > + if (sscanf (lines[row], "%d%" SCNi64 "B%" SCNi64 "B%" SCNi64 "B" "%s", > + &part_num, > + &temp_int64, > + &temp_int64, > + &temp_int64, > + temp_type) != 5) { We're hoping here that th...
2014 Dec 05
2
Re: [PATCH 1/8] New API: btrfs_subvolume_get_default
...(out + 2, NULL, 10, &ret, NULL); Unfortunately even gnulib's "xstrtol" function is a minefield, and the code above won't work [specifically -- it's insecure] on 32 bit machines. Anyway, I think it's better to use sscanf here, so: if (sscanf (out, "ID %" SCNi64, &ret) != 2) { // error ... } > + if (r != LONGINT_OK) { > + reply_with_error ("%s: could not parse subvolume id: %s.", argv[0], out); > + return -1; > + } > + > + return ret; > +} > + > int > do_btrfs_filesystem_sync (const char *fs) &...
2018 Apr 27
4
[PATCH v5 0/3] libguestfs: guestfs_list_filesystems: skip block devices which cannot hold file system
This patch series: 1. Addresses comments from last review: part_get_mbr_part_type doesn't break original implementation in C. 2. Rebased on top of master and little bit refactored for readability. Mykola Ivanets (1): tests: md: Test guestfish list-filesystems command skips partitioned md devices. Nikolay Ivanets (2): daemon: Reimplement 'part_get_mbr_part_type' API in
2015 Mar 24
2
Re: [PATCH] New API: part_get_part_type for showing partition type
...> + } > > + > > + /* Now parse the lines. */ > > + size_t i; > > + int64_t temp_int64; > > + int part_num; > > + char temp_type[16]; > > + for (i = 0, row = start; row < end; ++i, ++row) { > > + if (sscanf (lines[row], "%d%" SCNi64 "B%" SCNi64 "B%" SCNi64 "B" "%s", > > + &part_num, > > + &temp_int64, > > + &temp_int64, > > + &temp_int64, > > + temp_type) != 5) { >...
2018 May 01
9
[PATCH v6 0/7] daemon: list_filesystems: filter out block devices which cannot hold filesystem
This patch series: 1. Addresses comments from v5 series review 2. Large commit is splitted to more granular commits for better code review. Mykola Ivanets (6): daemon: Changing the way that we detect if a device contains partitions. daemon: list-filesystems: Ignore partitioned MD devices. tests: list-filesystems command ignores partitioned MD devices. daemon: list-filesystems: Change
2015 Jul 17
1
[PATCH] daemon: add a space after func/macro to fit code-style
...r (i = 0, row = start; row < end; ++i, ++row) { if (STREQ (parttype, "gpt")) { - memcpy (temp_type, "primary", strlen("primary")); + memcpy (temp_type, "primary", strlen ("primary")); if (sscanf (lines[row], "%d%" SCNi64 "B%" SCNi64 "B%" SCNi64 "B", &part_num, &temp_int64, @@ -1117,15 +1117,15 @@ do_part_get_mbr_part_type (const char *device, int partnum) continue; if (STRPREFIX (temp_type, "primary")) { - part_type...
2015 Jul 02
0
[PATCH] Fix various -Wformat problems.
...} diff --git a/daemon/ext2.c b/daemon/ext2.c index 8ef6d5f..9142a38 100644 --- a/daemon/ext2.c +++ b/daemon/ext2.c @@ -780,11 +780,16 @@ do_get_e2generation (const char *filename) return -1; } - if (sscanf (out, "%" SCNu64, &ret) != 1) { + if (sscanf (out, "%" SCNi64, &ret) != 1) { reply_with_error ("cannot parse output from '%s' command: %s", "lsattr", out); return -1; } + if (ret < 0) { + reply_with_error ("unexpected negative number from '%s' command: %s", +...