search for: asprintf

Displaying 20 results from an estimated 669 matches for "asprintf".

Did you mean: sprintf
2023 Feb 15
2
[libnbd PATCH v3 11/29] socket activation: fix error message upon asprintf() failure
Correctly report "asprintf" in the error message when asprintf() fails. Signed-off-by: Laszlo Ersek <lersek at redhat.com> --- generator/states-connect-socket-activation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generator/states-connect-socket-activation.c b/generator/states-connect-s...
2016 Feb 01
0
[klibc:master] Make asprintf() a simple wrapper around vasprintf()
...tp://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=17fabd540aeb5019909a024243c6d26610cab307 Author: H. Peter Anvin <hpa at zytor.com> AuthorDate: Mon, 1 Feb 2016 01:55:04 -0800 Committer: H. Peter Anvin <hpa at zytor.com> CommitDate: Mon, 1 Feb 2016 01:55:04 -0800 [klibc] Make asprintf() a simple wrapper around vasprintf() Since we have vasprintf() anyway, save about a hundred bytes (on x86-64) by making asprintf() a typical stdarg wrapper function. Signed-off-by: H. Peter Anvin <hpa at zytor.com> --- usr/klibc/asprintf.c | 13 ++----------- 1 file changed, 2 insertions...
2004 Oct 22
1
[PATCH] off-by-one in asprintf/vasprintf
Fix an off-by-one in asprintf and vasprintf. The return of vsnprintf is the number of bytes *not* including the terminating '\0'. The size argument to vsnprintf is the number of bytes *including* the terminating '\0'. diff -u klibc-0.188/klibc/asprintf.c udev/klibc-0.188/klibc/asprintf.c --- klibc-0.188/klibc...
2019 Jan 18
0
[klibc:master] remove unused variables
...0900e46752612a9ce4fadb Author: Greg Thelen <gthelen at google.com> AuthorDate: Sun, 25 Feb 2018 23:16:33 -0800 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Wed, 2 Jan 2019 03:08:04 +0000 [klibc] remove unused variables Fix compilation warnings: $KLIBC/usr/klibc/asprintf.c: In function 'asprintf': $KLIBC/usr/klibc/asprintf.c:14:8: warning: unused variable 'p' [-Wunused-variable] char *p; $KLIBC/usr/klibc/asprintf.c:13:6: warning: unused variable 'bytes' [-Wunused-variable] int bytes; $KLIBC/usr/utils/readlink.c: In function &...
2016 Aug 08
1
[PATCH] sleuthkit code cleanup
...ged, 3 insertions(+), 2 deletions(-) diff --git a/daemon/sleuthkit.c b/daemon/sleuthkit.c index ce738e3..e642731 100644 --- a/daemon/sleuthkit.c +++ b/daemon/sleuthkit.c @@ -47,7 +47,8 @@ do_download_inode (const mountable_t *mountable, int64_t inode) } /* Construct the command. */ - ret = asprintf(&cmd, "%s -r %s %" PRIi64, str_icat, mountable->device, inode); + ret = asprintf (&cmd, "%s -r %s %" PRIi64, + str_icat, mountable->device, inode); if (ret < 0) { reply_with_perror ("asprintf"); return -1; @@ -85,7 +86,7...
2006 Jul 13
2
Kerberos Keytab Code Update in 3.0.23
First thing - I'd like to say a big "THANK YOU" to the developers. I just upgraded to samba-3.0.23 and I've noticed an alarming issue with respect to my configuration. I've been using the built-in keytab management and it looks like the updated code no longer creates the userPrincipal in Active Directory. Whether this is an issue for others or not, it would be nice to have
2018 Feb 26
3
[PATCH 1/4] include sys/types.h in more places
Include sys/types.h to avoid compilation warnings: In file included from $LINUX/usr/include/linux/byteorder/little_endian.h:12:0, from $LINUX/usr/include/asm/byteorder.h:5, from $KLIBC/usr/klibc/../include/klibc/endian.h:11, from $KLIBC/usr/klibc/../include/endian.h:8, from $KLIBC/usr/klibc/pread.c:7:
2016 Apr 04
2
[PATCH 1/2] Use 'error' function consistently throughout.
...parent_name == NULL) + error (EXIT_FAILURE, errno, "strdup"); char *p = strrchr (parent_name, '/'); if (p) *p = '\0'; @@ -549,10 +544,8 @@ do_output_vgs (void) char uuid[33]; CLEANUP_FREE_STRING_LIST char **parents = NULL; - if (asprintf (&name, "/dev/%s", vgs->val[i].vg_name) == -1) { - perror ("asprintf"); - exit (EXIT_FAILURE); - } + if (asprintf (&name, "/dev/%s", vgs->val[i].vg_name) == -1) + error (EXIT_FAILURE, errno, "asprintf"); memcpy (uuid,...
2014 Jul 28
5
[PATCH] make-fs: respect libguestfs' temporary dir
...bec3e2..9c11fef 100644 --- a/make-fs/make-fs.c +++ b/make-fs/make-fs.c @@ -381,8 +381,9 @@ estimate_input (const char *input, uint64_t *estimate_rtn, char **ifmt_rtn) CLEANUP_FCLOSE FILE *fp = NULL; char line[256]; size_t len; + CLEANUP_FREE char *tmpdir = guestfs_get_tmpdir (g); - if (asprintf (&tmpfile, "/tmp/makefsXXXXXX") == -1) { + if (asprintf (&tmpfile, "%s/makefsXXXXXX", tmpdir) == -1) { perror ("asprintf"); return -1; } -- 1.9.3
2017 Feb 14
0
[PATCH 2/2] GCC 7: Allocate sufficient space for sprintf output.
...id) if (d == NULL) break; if (STRPREFIX (d->d_name, "virtio")) { - char mount_tag_path[256]; - snprintf (mount_tag_path, sizeof mount_tag_path, - BUS_PATH "/%s/mount_tag", d->d_name); + CLEANUP_FREE char *mount_tag_path; + if (asprintf (&mount_tag_path, BUS_PATH "/%s/mount_tag", + d->d_name) == -1) { + reply_with_perror ("asprintf"); + closedir (dir); + return NULL; + } /* A bit unclear, but it looks like the virtio transport allows * the mou...
2010 Jun 19
1
[PATCH 1/2] linux/syslinux.c: Silence warnings
From: Gene Cumm <gene.cumm at gmail.com> linux/syslinux.c: Silence warnings from GCC with asprintf's attribute warn_unused_result in certain glibc versions/patches. Assign it to a variable and ignore it as the string is already tested for null before using it. Signed-off-by: Gene Cumm <gene.cumm at gmail.com> --- diff --git a/libinstaller/setadv.c b/libinstaller/setadv.c index c891...
2014 May 26
2
[PATCH 2/2] Use setfiles from the appliance for the SELinux relabel (RHBZ#1089100).
...*sys_rootpath = NULL; + CLEANUP_FREE char *sys_filecontextpath = NULL; + CLEANUP_FREE char *sys_autorelabelpath = NULL; + CLEANUP_FREE char *err = NULL; + CLEANUP_FREE char *out = NULL; + int r; + int len; + const size_t MAX_ARGS = 16; + const char *argv[MAX_ARGS]; + size_t i = 0; - if (asprintf (&cmd, cmd_fmt, len, root, len, root) == -1) { - reply_with_perror ("asprintf"); + if (has_selinux_mountpoint () > 0) { + reply_with_error ("cannot work when SELinux is enabled in the " + "appliance\n"); return -1; } - out...
2017 Feb 14
0
[PATCH v2 2/2] GCC 7: Allocate sufficient space for sprintf output.
...id) if (d == NULL) break; if (STRPREFIX (d->d_name, "virtio")) { - char mount_tag_path[256]; - snprintf (mount_tag_path, sizeof mount_tag_path, - BUS_PATH "/%s/mount_tag", d->d_name); + CLEANUP_FREE char *mount_tag_path; + if (asprintf (&mount_tag_path, BUS_PATH "/%s/mount_tag", + d->d_name) == -1) { + reply_with_perror ("asprintf"); + closedir (dir); + return NULL; + } /* A bit unclear, but it looks like the virtio transport allows * the mou...
2004 May 03
4
ctags(1) command execution vulnerability
Hello, ctags(1) uses external application sort(1) for sorting the tags file. It calls it via system(3) function. Look at the /usr/src/usr.bin/ctags/ctags.c file, there are such lines here: if (uflag) { (void)asprintf(&cmd, "sort -o %s %s", outfile, outfile); if (cmd == NULL) err(1, "out of space"); system(cmd); free(cmd); cmd = NULL; } This code will be executed when "-u" arg was given. So, if we'll execute ctags in a such way: ctags -u -f ';echo hi' *...
2011 Dec 13
8
[PATCH] xenpaging: remove XOPEN_SOURCE
# HG changeset patch # User Roger Pau Monne <roger.pau@entel.upc.edu> # Date 1323768129 -3600 # Node ID 7697ee23b08b8eaca9aee4f6b79cf550a490bef7 # Parent 8a84f53376862427f254a017cb52c928dbdd3d32 xenpaging: remove XOPEN_SOURCE The XOPEN_SOURCE define was breaking the compilation under NetBSD. I''ve removed it becasue it is not necessary (at least under NetBSD). If it is necessary
2017 Apr 19
1
[PATCH] daemon: Remove use of fixed-size stack buffers.
...h_block_device (block_dev_func_t func, bool return_md) static int add_device (const char *device, struct stringsbuf *r) { - char dev_path[256]; - snprintf (dev_path, sizeof dev_path, "/dev/%s", device); + CLEANUP_FREE char *dev_path; - if (add_string (r, dev_path) == -1) { + if (asprintf (&dev_path, "/dev/%s", device) == -1) { + reply_with_perror ("asprintf"); return -1; } + if (add_string (r, dev_path) == -1) + return -1; + return 0; } @@ -153,10 +156,13 @@ do_list_devices (void) static int add_partitions (const char *device, struct...
2014 Oct 13
0
[PATCH] cat, diff: avoid double slashes in paths (RHBZ#1151910).
...49b779e 100644 --- a/cat/visit.c +++ b/cat/visit.c @@ -138,13 +138,18 @@ full_path (const char *dir, const char *name) { int r; char *path; + int len; + + len = strlen (dir); + if (len > 0 && dir[len - 1] == '/') + --len; if (STREQ (dir, "/")) r = asprintf (&path, "/%s", name ? name : ""); else if (name) - r = asprintf (&path, "%s/%s", dir, name); + r = asprintf (&path, "%.*s/%s", len, dir, name); else - r = asprintf (&path, "%s", dir); + r = asprintf (&path, &quo...
2018 Dec 14
2
Re: [PATCH nbdkit 1/3] sh: Implement inline scripts.
...be invoked via [script=]./- (there, script is optional because the leading ./ avoids the leading -). > +static char * > +inline_script (void) > +{ > + const char scriptname[] = "inline-script.sh"; > + char *filename = NULL; > + char *cmd = NULL; > + > + if (asprintf (&filename, "%s/%s", tmpdir, scriptname) == -1) { > + nbdkit_error ("asprintf: %m"); > + goto err; > + } > + > + /* Safe because both the tmpdir and script name are controlled by us > + * and don't contain characters that need quoting. > +...
2016 Mar 01
2
Re: [PATCH 3/3] fish: fix btrfs subvolumes display in error case
...EXIT_FAILURE); } guestfs_pop_error_handler (g); > + /* Reformat the internal btrfsvol string into a valid mount option */ > + if (device && volume && guestfs_last_errno (g) != EINVAL) { With the above, this needs to check device and subvolume only. > + if (asprintf (&p, "%s:/:subvol=%s", device, volume) == -1) { > + perror ("asprintf"); > + exit (EXIT_FAILURE); > + } > + } else { > + p = guestfs_canonical_device_name (g, fses[i]); > + } Usually there are no curly brackets for blocks...
2017 Apr 20
1
[PATCH] tests: Replace test-max-disks with several tests.
...(EXIT_FAILURE); + + /* Put some data on each disk to check they are writable and + * mountable. + */ + for (i = 0; i < ndisks; ++i) { + CLEANUP_FREE char *mp = NULL; + CLEANUP_FREE char *part = NULL; + CLEANUP_FREE char *file = NULL; + CLEANUP_FREE char *data = NULL; + + if (asprintf (&mp, "/mp%zu", i) == -1) + error (EXIT_FAILURE, errno, "asprintf"); + + if (guestfs_mkmountpoint (g, mp) == -1) + exit (EXIT_FAILURE); + + /* To save time in the test, add 15 partitions to the first disk + * and last disks only, and 1 partition to every...