search for: perror

Displaying 20 results from an estimated 1042 matches for "perror".

Did you mean: error
2015 Jun 18
1
[PATCH] error log: keep more calloc and its error messages match
...diff --git a/cat/cat.c b/cat/cat.c index 5a438ce..82f0055 100644 --- a/cat/cat.c +++ b/cat/cat.c @@ -191,7 +191,7 @@ main (int argc, char *argv[]) access (argv[optind], F_OK) == 0) { /* simulate -a option */ drv = calloc (1, sizeof (struct drv)); if (!drv) { - perror ("malloc"); + perror ("calloc"); exit (EXIT_FAILURE); } drv->type = drv_a; @@ -205,7 +205,7 @@ main (int argc, char *argv[]) } else { /* simulate -d option */ drv = calloc (1, sizeof (struct drv));...
2016 Apr 04
2
[PATCH 1/2] Use 'error' function consistently throughout.
Wherever we had code which did: if (something_bad) { perror (...); exit (EXIT_FAILURE); } replace this with use of the error(3) function: if (something_bad) error (EXIT_FAILURE, errno, ...); The error(3) function is supplied by glibc, or by gnulib on platforms which don't have it, and is much more flexible than perror(3). Since we alread...
2009 Aug 19
2
[PATCH libguestfs] guestfish: detect a few more failed syscalls
...ff --git a/fish/fish.c b/fish/fish.c index 830617b..e6cd270 100644 --- a/fish/fish.c +++ b/fish/fish.c @@ -750,8 +750,14 @@ issue_command (const char *cmd, char *argv[], const char *pipecmd) if (pipecmd) { int fd[2]; - fflush (stdout); - pipe (fd); + if (fflush (stdout)); { + perror ("failed to flush standard output"); + return -1; + } + if (pipe (fd)) { + perror ("pipe failed"); + return -1; + } pid = fork (); if (pid == -1) { perror ("fork"); @@ -760,7 +766,10 @@ issue_command (const char *cmd, char *argv...
2016 Jan 21
0
[PATCH v3 2/6] daemon: Split out command() functions and CLEANUP_* macros into separate files.
...+ va_list args; + /* NB: Mustn't free the strings which are on the stack. */ + CLEANUP_FREE const char **argv = NULL; + char *s; + size_t i; + int r; + + /* Collect the command line arguments into an array. */ + i = 2; + argv = malloc (sizeof (char *) * i); + if (argv == NULL) { + perror ("malloc"); + return -1; + } + argv[0] = (char *) name; + argv[1] = NULL; + + va_start (args, name); + + while ((s = va_arg (args, char *)) != NULL) { + const char **p = realloc (argv, sizeof (char *) * (++i)); + if (p == NULL) { + perror ("realloc"); + v...
2009 Nov 20
1
fix new failures from latest-from-gnulib syntax-check
...exit (1); + exit (EXIT_FAILURE); } } if (optind < argc) { usage (); - exit (1); + exit (EXIT_FAILURE); } cmdline = read_cmdline (); @@ -190,7 +190,7 @@ main (int argc, char *argv[]) vmchannel = strndup (p + 18, len); if (!vmchannel) { perror ("strndup"); - exit (1); + exit (EXIT_FAILURE); } } @@ -204,7 +204,7 @@ main (int argc, char *argv[]) vmchannel = strndup (p + 4, len); if (!vmchannel) { perror ("strndup"); - exit (1); + exit (EXIT_FAILUR...
2016 Dec 28
2
Help with httpd userdir recovery
...ername directory\n", argv[0]); exit(EXIT_FAILURE); } bufsize = sysconf(_SC_GETPW_R_SIZE_MAX); if (bufsize == -1) /* Value was indeterminate */ bufsize = 16384; /* Should be more than enough */ buf = malloc(bufsize); if (buf == NULL) { perror("malloc"); exit(EXIT_FAILURE); } s = getpwnam_r(argv[1], &pwd, buf, bufsize, &result); if (result == NULL) { if (s == 0) printf("Not found\n"); else { errno = s; perror("getpwnam_r");...
2015 Nov 13
4
[PATCH 1/4] extlinux: simplification
...turn -1; } +static int ext_install_ldlinux_c32(const char *path) +{ + char *file; + int fd, rv; + + rv = asprintf(&file, "%s%sldlinux.c32", + path, path[0] && path[strlen(path) - 1] == '/' ? "" : "/"); + if (rv < 0 || !file) { + perror(program); + return 1; + } + + fd = open(file, O_WRONLY | O_TRUNC | O_CREAT | O_SYNC, + S_IRUSR | S_IRGRP | S_IROTH); + if (fd < 0) { + perror(file); + free(file); + return 1; + } + + rv = xpwrite(fd, (const char _force *)syslinux_ldlinuxc32, + syslinux_ldlinuxc32_len, 0);...
2012 Jun 06
3
[LLVMdev] llvm-tv
...ry. I'll have a look at the code to sort out the build errors. Have you tried compiling/using llvm-tv with these versions of poolalloc and LLVM-3.0? Here is the llvm-tv build error - /home/arhishee/work/llvm-tv/llvm-tv/lib/Snapshot/FileUtils.cpp:32:5: error: use of undeclared identifier 'perror' perror("scandir"); ^ /home/arhishee/work/llvm-tv/llvm-tv/lib/Snapshot/FileUtils.cpp:50:5: error: use of undeclared identifier 'perror' perror("scandir"); ^ On Tue, Jun 5, 2012 at 8:23 AM, John Criswell <criswell at illinois.edu> wrote: >...
2015 Nov 04
2
Retrieving datas sent by host within the Guest
...hin the Guest. Host send these datas trough a channel UNIX type , by using AF_UNIX socket stuff. If i try to retrive the datas by using such type of thing in the Guest : #define NAME "/dev/virtio-ports/agent" sock = socket(AF_UNIX, SOCK_STREAM, 0); 12 if (sock < 0) { 13 perror("opening stream socket"); 14 exit(1); 15 } 16 server.sun_family = AF_UNIX; 17 strcpy(server.sun_path, NAME); 18 if (bind(sock, (struct sockaddr *) &server, sizeof(struct sockaddr_un))) { 19 perror("binding stream socket"); 20 exit(1);...
2019 Sep 30
1
Re: [PATCH libnbd v2 1/2] lib: Don't use perror after fork in nbd_connect_callback.
On 9/30/19 11:32 AM, Richard W.M. Jones wrote: > perror is not fork-safe and so could deadlock. Instead open code a > fork-safe version of perror. While this fixes the current behaviour, > in the long term we'd like to capture the error message into the usual > error mechanism, so this is not the full and final fix for this issue. > &...
2010 Sep 20
1
[PATCH] Fix error launching libguestfs when euid != uid
...== -1) { + error (g, _("pipe failed: %m")); return NULL; + } + + int pid = fork_helper(g); + if (pid == -1) { + return NULL; + } + + /* exec febootstrap-supermin-helper in the child */ + if (pid == 0) { + /* Close the read end */ + if(close(fds[0]) == -1) { + perror("close read end"); + exit(1); + } + + /* dup2 the write end to stdout */ + if(dup2(fds[1], STDOUT_FILENO) == -1) { + perror("dup2"); + exit(1); + } + + /* Close the write end */ + if(close(fds[1]) == -1) { + perror("close write end&qu...
2015 Dec 02
3
[PATCH] daemon: improve internal commandrvf
...* to make sure processes have an open stdin, and it is not - * possible to rely on the guest to provide it (Linux guests - * get /dev dynamically populated at runtime by udev). - */ - dev_null_fd = open ("/dev/null", O_RDONLY|O_CLOEXEC); - if (dev_null_fd == -1) { - reply_with_perror ("/dev/null"); - return NULL; - } - if (bind_mount (&bind_state) == -1) return NULL; if (enable_network) { @@ -279,11 +268,9 @@ do_command (char *const *argv) return NULL; } - flags = COMMAND_FLAG_CHROOT_COPY_FILE_TO_STDIN | dev_null_fd; + flags = COMMAND_...
2020 Aug 11
3
[PATCH v3] virtio-rng: return available data with O_NONBLOCK
...t fd, int sec) > { > struct pollfd pfd = { .fd = fd, .events = POLLIN, }; > unsigned long errors = 0, eagains = 0, bytes = 0, succ = 0; > int size, rc, rd; > > srandom(getpid()); > if (CONDITION && fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK) == -1) > perror("fcntl"); > size = MINBUFSIZ + random() % (MAXBUFSIZ - MINBUFSIZ + 1); > > for(;;) { > char buf[size]; > > if (stop) > break; > rc = poll(&pfd, 1, sec); > if (rc > 0) { > rd = read(fd, buf, sizeof(buf)); > if (rd == -1 &&amp...
2020 Aug 11
3
[PATCH v3] virtio-rng: return available data with O_NONBLOCK
...t fd, int sec) > { > struct pollfd pfd = { .fd = fd, .events = POLLIN, }; > unsigned long errors = 0, eagains = 0, bytes = 0, succ = 0; > int size, rc, rd; > > srandom(getpid()); > if (CONDITION && fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK) == -1) > perror("fcntl"); > size = MINBUFSIZ + random() % (MAXBUFSIZ - MINBUFSIZ + 1); > > for(;;) { > char buf[size]; > > if (stop) > break; > rc = poll(&pfd, 1, sec); > if (rc > 0) { > rd = read(fd, buf, sizeof(buf)); > if (rd == -1 &&amp...
2019 Sep 30
0
[PATCH libnbd v2 1/2] lib: Don't use perror after fork in nbd_connect_callback.
perror is not fork-safe and so could deadlock. Instead open code a fork-safe version of perror. While this fixes the current behaviour, in the long term we'd like to capture the error message into the usual error mechanism, so this is not the full and final fix for this issue. Also this fixes the e...
2014 Aug 28
14
[PATCH 00/13] code refactorings for tools
Hi, this series does a couple of code reorganizations/refactoring in code used by tools: the windows path handling code, and the two types of file editing (using editor, and using perl expression). There's still a code duplication between the two variants of file editing, but it is just within a single source, and can be easily solved now (planning as next step). Pino Toscano (13): edit:
2010 Mar 11
2
[PATCH FOR DISCUSSION ONLY] Rewrite libguestfs-supermin-helper in C.
...ot;, candidates[i]); + + /* Ignore "vmlinuz-" at the beginning of the kernel name. */ + const char *version = &candidates[i][8]; + + /* /lib/modules/<version> */ + char *modpath = malloc (strlen (MODULESDIR) + strlen (version) + 2); + if (modpath == NULL) { + perror ("malloc"); + exit (1); + } + sprintf (modpath, MODULESDIR "/%s", version); + + if (verbose >= 2) + fprintf (stderr, "checking modpath %s is a directory\n", modpath); + + if (isdir (modpath)) { + if (verbose >= 2) + fprintf (stde...
2009 Nov 26
1
[PATCH] daemon/Win32: Use Gnulib perror module.
...o Xen guests. http://et.redhat.com/~rjones/virt-p2v -------------- next part -------------- >From b76462f7433d064019382992163e3553c7906ee7 Mon Sep 17 00:00:00 2001 From: Richard Jones <rjones at redhat.com> Date: Thu, 26 Nov 2009 11:13:00 +0000 Subject: [PATCH 1/2] daemon/Win32: Use Gnulib perror module. --- daemon/m4/gnulib-cache.m4 | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/daemon/m4/gnulib-cache.m4 b/daemon/m4/gnulib-cache.m4 index bba5744..01da897 100644 --- a/daemon/m4/gnulib-cache.m4 +++ b/daemon/m4/gnulib-cache.m4 @@ -15,7 +15,7 @@ # Specificati...
2016 Feb 17
8
[PATCH supermin 0/2] Allow an alternate libc to be used for init.
v1 -> v2: - If we split out the init program into a separate init/ directory, that makes it much easier to build against an alternate libc. I tried to build against uClibc, but uClibc requires an entire build chain, which looked like it was going to be a massive ballache. Rich.
2013 Apr 17
2
Confusing error message when pointing the linux installer at a missing directory.
...g to a subdirectory to keep the layout neat: syslinux-5.01/linux# ./syslinux -i -d /boot /dev/mmcblk0p1 /dev/mmcblk0p1: No such file or directory The message is coming from do_open_file() in syslinux.c: the call to open() fails because the containing directory isn't present, and then it calls perror(opt.device). If the directory is present, syslinux installs and will boot. It's just a matter of either improving the error message or trying to make the directory before populating it. -- Jack