diff options
Diffstat (limited to 'daemon')
-rw-r--r-- | daemon/configure.ac | 32 | ||||
-rw-r--r-- | daemon/daemon.h | 4 | ||||
-rw-r--r-- | daemon/debug.c | 10 | ||||
-rw-r--r-- | daemon/devsparts.c | 50 | ||||
-rw-r--r-- | daemon/dir.c | 4 | ||||
-rw-r--r-- | daemon/ext2.c | 32 | ||||
-rw-r--r-- | daemon/file.c | 18 | ||||
-rw-r--r-- | daemon/guestfsd.c | 64 | ||||
-rw-r--r-- | daemon/inotify.c | 26 | ||||
-rw-r--r-- | daemon/link.c | 14 | ||||
-rw-r--r-- | daemon/lvm.c | 28 | ||||
-rw-r--r-- | daemon/mount.c | 40 | ||||
-rw-r--r-- | daemon/proto.c | 48 | ||||
-rw-r--r-- | daemon/readdir.c | 2 | ||||
-rw-r--r-- | daemon/sfdisk.c | 8 | ||||
-rw-r--r-- | daemon/xattr.c | 22 |
16 files changed, 201 insertions, 201 deletions
diff --git a/daemon/configure.ac b/daemon/configure.ac index 243f353a..3bfd2ed2 100644 --- a/daemon/configure.ac +++ b/daemon/configure.ac @@ -48,19 +48,19 @@ AM_PROG_CC_C_O dnl Check for Augeas (now optional). AC_CHECK_LIB([augeas],[aug_match],[ - LIBS="-laugeas $LIBS" - have_augeas=yes - dnl Check for functions not available in earlier versions of Augeas. - AC_CHECK_FUNCS([aug_load aug_defvar aug_defnode]) - ],[have_augeas=no]) + LIBS="-laugeas $LIBS" + have_augeas=yes + dnl Check for functions not available in earlier versions of Augeas. + AC_CHECK_FUNCS([aug_load aug_defvar aug_defnode]) + ],[have_augeas=no]) if test "x$have_augeas" = "xyes"; then - AC_DEFINE([HAVE_AUGEAS],[1],[Define to 1 if you have Augeas]) + AC_DEFINE([HAVE_AUGEAS],[1],[Define to 1 if you have Augeas]) fi dnl Check for XDR library. AC_CHECK_LIB([portablexdr],[xdrmem_create],[],[ - AC_SEARCH_LIBS([xdrmem_create],[rpc xdr nsl]) - ]) + AC_SEARCH_LIBS([xdrmem_create],[rpc xdr nsl]) + ]) dnl Functions which may not be available in older distributions. AC_CHECK_FUNCS([futimens listxattr llistxattr getxattr lgetxattr setxattr lsetxattr removexattr lremovexattr]) @@ -68,14 +68,14 @@ AC_CHECK_FUNCS([futimens listxattr llistxattr getxattr lgetxattr setxattr lsetxa dnl For modified printf, we need glibc either (old-style) dnl register_printf_function or (new-style) register_printf_specifier. AC_CHECK_FUNC([register_printf_specifier],[ - AC_DEFINE([HAVE_REGISTER_PRINTF_SPECIFIER],[1], - [Define to 1 if you have new-style register_printf_specifier]) - ],[ - AC_CHECK_FUNC([register_printf_function],[ - AC_DEFINE([HAVE_REGISTER_PRINTF_FUNCTION],[1], - [Define to 1 if you have old-style register_printf_function]) - ],[ - AC_MSG_FAILURE( + AC_DEFINE([HAVE_REGISTER_PRINTF_SPECIFIER],[1], + [Define to 1 if you have new-style register_printf_specifier]) + ],[ + AC_CHECK_FUNC([register_printf_function],[ + AC_DEFINE([HAVE_REGISTER_PRINTF_FUNCTION],[1], + [Define to 1 if you have old-style register_printf_function]) + ],[ + AC_MSG_FAILURE( [No support for glibc-style extended printf formatters. This means you either have a very old glibc (pre-2.0) or you diff --git a/daemon/daemon.h b/daemon/daemon.h index 9aa831a5..70a23519 100644 --- a/daemon/daemon.h +++ b/daemon/daemon.h @@ -48,9 +48,9 @@ extern void free_stringslen (char **argv, int len); extern int command (char **stdoutput, char **stderror, const char *name, ...); extern int commandr (char **stdoutput, char **stderror, const char *name, ...); extern int commandv (char **stdoutput, char **stderror, - char * const* const argv); + char * const* const argv); extern int commandrv (char **stdoutput, char **stderror, - char * const* const argv); + char * const* const argv); extern char **split_lines (char *str); diff --git a/daemon/debug.c b/daemon/debug.c index 68320a31..13b7240f 100644 --- a/daemon/debug.c +++ b/daemon/debug.c @@ -157,11 +157,11 @@ debug_fds (const char *subcmd, int argc, char *const *const argv) if (S_ISLNK (statbuf.st_mode)) { r = readlink (fname, link, sizeof link - 1); if (r == -1) { - reply_with_perror ("readline: %s", fname); - fclose (fp); - free (out); - closedir (dir); - return NULL; + reply_with_perror ("readline: %s", fname); + fclose (fp); + free (out); + closedir (dir); + return NULL; } link[r] = '\0'; diff --git a/daemon/devsparts.c b/daemon/devsparts.c index 33579ba5..1970e7d0 100644 --- a/daemon/devsparts.c +++ b/daemon/devsparts.c @@ -46,8 +46,8 @@ do_list_devices (void) while ((d = readdir (dir)) != NULL) { if (strncmp (d->d_name, "sd", 2) == 0 || - strncmp (d->d_name, "hd", 2) == 0 || - strncmp (d->d_name, "vd", 2) == 0) { + strncmp (d->d_name, "hd", 2) == 0 || + strncmp (d->d_name, "vd", 2) == 0) { snprintf (buf, sizeof buf, "/dev/%s", d->d_name); /* RHBZ#514505: Some versions of qemu <= 0.10 add a @@ -56,14 +56,14 @@ do_list_devices (void) */ int fd = open (buf, O_RDONLY); if (fd == -1) { - perror (buf); - continue; + perror (buf); + continue; } close (fd); if (add_string (&r, &size, &alloc, buf) == -1) { - closedir (dir); - return NULL; + closedir (dir); + return NULL; } } } @@ -100,8 +100,8 @@ do_list_partitions (void) while ((d = readdir (dir)) != NULL) { if (strncmp (d->d_name, "sd", 2) == 0 || - strncmp (d->d_name, "hd", 2) == 0 || - strncmp (d->d_name, "vd", 2) == 0) { + strncmp (d->d_name, "hd", 2) == 0 || + strncmp (d->d_name, "vd", 2) == 0) { snprintf (buf, sizeof buf, "/dev/%s", d->d_name); /* RHBZ#514505: Some versions of qemu <= 0.10 add a @@ -110,8 +110,8 @@ do_list_partitions (void) */ int fd = open (buf, O_RDONLY); if (fd == -1) { - perror (buf); - continue; + perror (buf); + continue; } close (fd); @@ -122,26 +122,26 @@ do_list_partitions (void) dir2 = opendir (buf); if (!dir2) { - reply_with_perror ("opendir: %s", buf); - free_stringslen (r, size); - return NULL; + reply_with_perror ("opendir: %s", buf); + free_stringslen (r, size); + return NULL; } while ((d = readdir (dir2)) != NULL) { - if (strncmp (d->d_name, devname, strlen (devname)) == 0) { - snprintf (buf, sizeof buf, "/dev/%s", d->d_name); - - if (add_string (&r, &size, &alloc, buf) == -1) { - closedir (dir2); - closedir (dir); - return NULL; - } - } + if (strncmp (d->d_name, devname, strlen (devname)) == 0) { + snprintf (buf, sizeof buf, "/dev/%s", d->d_name); + + if (add_string (&r, &size, &alloc, buf) == -1) { + closedir (dir2); + closedir (dir); + return NULL; + } + } } if (closedir (dir2) == -1) { - reply_with_perror ("closedir: /sys/block/%s", devname); - free_stringslen (r, size); - return NULL; + reply_with_perror ("closedir: /sys/block/%s", devname); + free_stringslen (r, size); + return NULL; } } } diff --git a/daemon/dir.c b/daemon/dir.c index a8f066fd..5945862e 100644 --- a/daemon/dir.c +++ b/daemon/dir.c @@ -123,8 +123,8 @@ recursive_mkdir (const char *path) r = lstat (path, &buf); if (r == -1) return -1; if (!S_ISDIR (buf.st_mode)) { - errno = ENOTDIR; - return -1; + errno = ENOTDIR; + return -1; } return 0; /* OK - directory exists here already. */ } diff --git a/daemon/ext2.c b/daemon/ext2.c index 5a1d0fdb..0f7a66c1 100644 --- a/daemon/ext2.c +++ b/daemon/ext2.c @@ -77,31 +77,31 @@ do_tune2fs_l (char *device) do { colon++; } while (*colon && isspace (*colon)); if (add_string (&ret, &size, &alloc, p) == -1) { - free (out); - return NULL; + free (out); + return NULL; } if (strcmp (colon, "<none>") == 0 || - strcmp (colon, "<not available>") == 0 || - strcmp (colon, "(none)") == 0) { - if (add_string (&ret, &size, &alloc, "") == -1) { - free (out); - return NULL; - } + strcmp (colon, "<not available>") == 0 || + strcmp (colon, "(none)") == 0) { + if (add_string (&ret, &size, &alloc, "") == -1) { + free (out); + return NULL; + } } else { - if (add_string (&ret, &size, &alloc, colon) == -1) { - free (out); - return NULL; - } + if (add_string (&ret, &size, &alloc, colon) == -1) { + free (out); + return NULL; + } } } else { if (add_string (&ret, &size, &alloc, p) == -1) { - free (out); - return NULL; + free (out); + return NULL; } if (add_string (&ret, &size, &alloc, "") == -1) { - free (out); - return NULL; + free (out); + return NULL; } } diff --git a/daemon/file.c b/daemon/file.c index aab7e93e..63d8dd2d 100644 --- a/daemon/file.c +++ b/daemon/file.c @@ -97,18 +97,18 @@ do_cat (char *path) if (size >= alloc) { alloc += 8192; if (alloc > max) { - reply_with_error ("cat: %s: file is too large for message buffer", - path); - free (buf); - close (fd); - return NULL; + reply_with_error ("cat: %s: file is too large for message buffer", + path); + free (buf); + close (fd); + return NULL; } buf2 = realloc (buf, alloc); if (buf2 == NULL) { - reply_with_perror ("realloc"); - free (buf); - close (fd); - return NULL; + reply_with_perror ("realloc"); + free (buf); + close (fd); + return NULL; } buf = buf2; } diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c index e8fb48fc..07a1c5e0 100644 --- a/daemon/guestfsd.c +++ b/daemon/guestfsd.c @@ -159,11 +159,11 @@ main (int argc, char *argv[]) p += 8; p2 = strchr (p, ':'); if (p2) { - *p2++ = '\0'; - host = p; - r = strcspn (p2, " \n"); - p2[r] = '\0'; - port = p2; + *p2++ = '\0'; + host = p; + r = strcspn (p2, " \n"); + p2[r] = '\0'; + port = p2; } } } @@ -209,7 +209,7 @@ main (int argc, char *argv[]) sock = socket (rr->ai_family, rr->ai_socktype, rr->ai_protocol); if (sock != -1) { if (connect (sock, rr->ai_addr, rr->ai_addrlen) == 0) - break; + break; perror ("connect"); close (sock); @@ -578,40 +578,40 @@ commandrv (char **stdoutput, char **stderror, char * const* const argv) if (FD_ISSET (so_fd[0], &rset2)) { /* something on stdout */ r = read (so_fd[0], buf, sizeof buf); if (r == -1) { - perror ("read"); - goto quit; + perror ("read"); + goto quit; } if (r == 0) { FD_CLR (so_fd[0], &rset); quit++; } if (r > 0 && stdoutput) { - so_size += r; - p = realloc (*stdoutput, so_size); - if (p == NULL) { - perror ("realloc"); - goto quit; - } - *stdoutput = p; - memcpy (*stdoutput + so_size - r, buf, r); + so_size += r; + p = realloc (*stdoutput, so_size); + if (p == NULL) { + perror ("realloc"); + goto quit; + } + *stdoutput = p; + memcpy (*stdoutput + so_size - r, buf, r); } } if (FD_ISSET (se_fd[0], &rset2)) { /* something on stderr */ r = read (se_fd[0], buf, sizeof buf); if (r == -1) { - perror ("read"); - goto quit; + perror ("read"); + goto quit; } if (r == 0) { FD_CLR (se_fd[0], &rset); quit++; } if (r > 0 && stderror) { - se_size += r; - p = realloc (*stderror, se_size); - if (p == NULL) { - perror ("realloc"); - goto quit; - } - *stderror = p; - memcpy (*stderror + se_size - r, buf, r); + se_size += r; + p = realloc (*stderror, se_size); + if (p == NULL) { + perror ("realloc"); + goto quit; + } + *stderror = p; + memcpy (*stderror + se_size - r, buf, r); } } } @@ -643,7 +643,7 @@ commandrv (char **stdoutput, char **stderror, char * const* const argv) (*stderror)[se_size] = '\0'; se_size--; while (se_size >= 0 && (*stderror)[se_size] == '\n') - (*stderror)[se_size--] = '\0'; + (*stderror)[se_size--] = '\0'; } } @@ -722,7 +722,7 @@ print_shell_quote (FILE *stream, const void *const *args) { #define SAFE(c) (isalnum((c)) || \ - (c) == '/' || (c) == '-' || (c) == '_' || (c) == '.') + (c) == '/' || (c) == '-' || (c) == '_' || (c) == '.') int i, len; const char *str = *((const char **) (args[0])); @@ -740,11 +740,11 @@ print_shell_quote (FILE *stream, static int print_sysroot_shell_quote (FILE *stream, - const struct printf_info *info, - const void *const *args) + const struct printf_info *info, + const void *const *args) { #define SAFE(c) (isalnum((c)) || \ - (c) == '/' || (c) == '-' || (c) == '_' || (c) == '.') + (c) == '/' || (c) == '-' || (c) == '_' || (c) == '.') fputs (sysroot, stream); return sysroot_len + print_shell_quote (stream, info, args); } @@ -752,7 +752,7 @@ print_sysroot_shell_quote (FILE *stream, #ifdef HAVE_REGISTER_PRINTF_SPECIFIER static int print_arginfo (const struct printf_info *info, - size_t n, int *argtypes, int *size) + size_t n, int *argtypes, int *size) { if (n > 0) { argtypes[0] = PA_STRING; diff --git a/daemon/inotify.c b/daemon/inotify.c index 43f282db..4bc6f179 100644 --- a/daemon/inotify.c +++ b/daemon/inotify.c @@ -165,10 +165,10 @@ do_inotify_read (void) int n, r; r = read (inotify_fd, inotify_buf + inotify_posn, - sizeof (inotify_buf) - inotify_posn); + sizeof (inotify_buf) - inotify_posn); if (r == -1) { if (errno == EWOULDBLOCK || errno == EAGAIN) /* End of list. */ - break; + break; reply_with_perror ("read"); goto error; } @@ -190,18 +190,18 @@ do_inotify_read (void) /* Have we got a complete event in the buffer? */ #ifdef __GNUC__ if (n + sizeof (struct inotify_event) > inotify_posn || - n + sizeof (struct inotify_event) + event->len > inotify_posn) - break; + n + sizeof (struct inotify_event) + event->len > inotify_posn) + break; #else #error "this code needs fixing so it works on non-GCC compilers" #endif np = realloc (ret->guestfs_int_inotify_event_list_val, - (ret->guestfs_int_inotify_event_list_len + 1) * - sizeof (guestfs_int_inotify_event)); + (ret->guestfs_int_inotify_event_list_len + 1) * + sizeof (guestfs_int_inotify_event)); if (np == NULL) { - reply_with_perror ("realloc"); - goto error; + reply_with_perror ("realloc"); + goto error; } ret->guestfs_int_inotify_event_list_val = np; in = &ret->guestfs_int_inotify_event_list_val[ret->guestfs_int_inotify_event_list_len]; @@ -212,12 +212,12 @@ do_inotify_read (void) in->in_cookie = event->cookie; if (event->len > 0) - in->in_name = strdup (event->name); + in->in_name = strdup (event->name); else - in->in_name = strdup (""); /* Should have optional string fields XXX. */ + in->in_name = strdup (""); /* Should have optional string fields XXX. */ if (in->in_name == NULL) { - reply_with_perror ("strdup"); - goto error; + reply_with_perror ("strdup"); + goto error; } /* Estimate space used by this event in the message. */ @@ -279,7 +279,7 @@ do_inotify_files (void) const char *name = events->guestfs_int_inotify_event_list_val[i].in_name; if (name[0] != '\0') - fprintf (fp, "%s\n", name); + fprintf (fp, "%s\n", name); } xdr_free ((xdrproc_t) xdr_guestfs_int_inotify_event_list, (char *) events); diff --git a/daemon/link.c b/daemon/link.c index 57e35384..29ae6794 100644 --- a/daemon/link.c +++ b/daemon/link.c @@ -90,19 +90,19 @@ _link (const char *flag, int symbolic, const char *target, const char *linkname) if (flag) r = command (NULL, &err, - "ln", flag, "--", /* target could begin with '-' */ - buf_target ? : target, buf_linkname, NULL); + "ln", flag, "--", /* target could begin with '-' */ + buf_target ? : target, buf_linkname, NULL); else r = command (NULL, &err, - "ln", "--", - buf_target ? : target, buf_linkname, NULL); + "ln", "--", + buf_target ? : target, buf_linkname, NULL); free (buf_linkname); free (buf_target); if (r == -1) { reply_with_error ("ln%s%s: %s: %s: %s", - flag ? " " : "", - flag ? : "", - target, linkname, err); + flag ? " " : "", + flag ? : "", + target, linkname, err); free (err); return -1; } diff --git a/daemon/lvm.c b/daemon/lvm.c index 01b6435e..624dcf34 100644 --- a/daemon/lvm.c +++ b/daemon/lvm.c @@ -93,7 +93,7 @@ do_pvs (void) int r; r = command (&out, &err, - "/sbin/lvm", "pvs", "-o", "pv_name", "--noheadings", NULL); + "/sbin/lvm", "pvs", "-o", "pv_name", "--noheadings", NULL); if (r == -1) { reply_with_error ("%s", err); free (out); @@ -113,7 +113,7 @@ do_vgs (void) int r; r = command (&out, &err, - "/sbin/lvm", "vgs", "-o", "vg_name", "--noheadings", NULL); + "/sbin/lvm", "vgs", "-o", "vg_name", "--noheadings", NULL); if (r == -1) { reply_with_error ("%s", err); free (out); @@ -133,9 +133,9 @@ do_lvs (void) int r; r = command (&out, &err, - "/sbin/lvm", "lvs", - "-o", "vg_name,lv_name", "--noheadings", - "--separator", "/", NULL); + "/sbin/lvm", "lvs", + "-o", "vg_name,lv_name", "--noheadings", + "--separator", "/", NULL); if (r == -1) { reply_with_error ("%s", err); free (out); @@ -179,7 +179,7 @@ do_pvcreate (char *device) IS_DEVICE (device, -1); r = command (NULL, &err, - "/sbin/lvm", "pvcreate", device, NULL); + "/sbin/lvm", "pvcreate", device, NULL); if (r == -1) { reply_with_error ("%s", err); free (err); @@ -240,8 +240,8 @@ do_lvcreate (char *logvol, char *volgroup, int mbytes) snprintf (size, sizeof size, "%d", mbytes); r = command (NULL, &err, - "/sbin/lvm", "lvcreate", - "-L", size, "-n", logvol, volgroup, NULL); + "/sbin/lvm", "lvcreate", + "-L", size, "-n", logvol, volgroup, NULL); if (r == -1) { reply_with_error ("%s", err); free (err); @@ -267,8 +267,8 @@ do_lvresize (char *logvol, int mbytes) snprintf (size, sizeof size, "%d", mbytes); r = command (NULL, &err, - "/sbin/lvm", "lvresize", - "-L", size, logvol, NULL); + "/sbin/lvm", "lvresize", + "-L", size, logvol, NULL); if (r == -1) { reply_with_error ("lvresize: %s", err); free (err); @@ -355,7 +355,7 @@ do_lvremove (char *device) IS_DEVICE (device, -1); r = command (NULL, &err, - "/sbin/lvm", "lvremove", "-f", device, NULL); + "/sbin/lvm", "lvremove", "-f", device, NULL); if (r == -1) { reply_with_error ("%s", err); free (err); @@ -376,7 +376,7 @@ do_vgremove (char *device) int r; r = command (NULL, &err, - "/sbin/lvm", "vgremove", "-f", device, NULL); + "/sbin/lvm", "vgremove", "-f", device, NULL); if (r == -1) { reply_with_error ("%s", err); free (err); @@ -399,7 +399,7 @@ do_pvremove (char *device) IS_DEVICE (device, -1); r = command (NULL, &err, - "/sbin/lvm", "pvremove", "-ff", device, NULL); + "/sbin/lvm", "pvremove", "-ff", device, NULL); if (r == -1) { reply_with_error ("%s", err); free (err); @@ -422,7 +422,7 @@ do_pvresize (char *device) IS_DEVICE (device, -1); r = command (NULL, &err, - "/sbin/lvm", "pvresize", device, NULL); + "/sbin/lvm", "pvresize", device, NULL); if (r == -1) { reply_with_error ("pvresize: %s: %s", device, err); free (err); diff --git a/daemon/mount.c b/daemon/mount.c index e7265fe2..9754ca9a 100644 --- a/daemon/mount.c +++ b/daemon/mount.c @@ -42,7 +42,7 @@ int root_mounted = 0; int do_mount_vfs (char *options, char *vfstype, - char *device, char *mountpoint) + char *device, char *mountpoint) { int r, is_root; char *mp; @@ -65,10 +65,10 @@ do_mount_vfs (char *options, char *vfstype, if (vfstype) r = command (NULL, &error, - "mount", "-o", options, "-t", vfstype, device, mp, NULL); + "mount", "-o", options, "-t", vfstype, device, mp, NULL); else r = command (NULL, &error, - "mount", "-o", options, device, mp, NULL); + "mount", "-o", options, device, mp, NULL); free (mp); if (r == -1) { reply_with_error ("mount: %s on %s: %s", device, mountpoint, error); @@ -96,7 +96,7 @@ do_mount_ro (char *device, char *mountpoint) int do_mount_options (char *options, char *device, - char *mountpoint) + char *mountpoint) { return do_mount_vfs (options, NULL, device, mountpoint); } @@ -176,22 +176,22 @@ mounts_or_mountpoints (int mp) if (p2 != NULL) { *p2 = '\0'; if (add_string (&ret, &size, &alloc, p) == -1) { - free (out); - return NULL; + free (out); + return NULL; } if (mp) { - p2 += 4 + sysroot_len; /* skip " on /sysroot" */ - len = strcspn (p2, " "); - - if (len == 0) /* .. just /sysroot, so we turn it into "/" */ - p2 = (char *) "/"; - else - p2[len] = '\0'; - - if (add_string (&ret, &size, &alloc, p2) == -1) { - free (out); - return NULL; - } + p2 += 4 + sysroot_len; /* skip " on /sysroot" */ + len = strcspn (p2, " "); + + if (len == 0) /* .. just /sysroot, so we turn it into "/" */ + p2 = (char *) "/"; + else + p2[len] = '\0'; + + if (add_string (&ret, &size, &alloc, p2) == -1) { + free (out); + return NULL; + } } } @@ -277,8 +277,8 @@ do_umount_all (void) p3 = p2 + strcspn (p2, " "); *p3 = '\0'; if (add_string (&mounts, &size, &alloc, p2) == -1) { - free (out); - return -1; + free (out); + return -1; } } diff --git a/daemon/proto.c b/daemon/proto.c index acd66017..709f978f 100644 --- a/daemon/proto.c +++ b/daemon/proto.c @@ -69,7 +69,7 @@ main_loop (int _sock) if (len > GUESTFS_MESSAGE_MAX) { fprintf (stderr, "guestfsd: incoming message is too long (%u bytes)\n", - len); + len); exit (1); } @@ -86,20 +86,20 @@ main_loop (int _sock) int i, j; for (i = 0; i < len; i += 16) { - printf ("%04x: ", i); - for (j = i; j < MIN (i+16, len); ++j) - printf ("%02x ", (unsigned char) buf[j]); - for (; j < i+16; ++j) - printf (" "); - printf ("|"); - for (j = i; j < MIN (i+16, len); ++j) - if (isprint (buf[j])) - printf ("%c", buf[j]); - else - printf ("."); - for (; j < i+16; ++j) - printf (" "); - printf ("|\n"); + printf ("%04x: ", i); + for (j = i; j < MIN (i+16, len); ++j) + printf ("%02x ", (unsigned char) buf[j]); + for (; j < i+16; ++j) + printf (" "); + printf ("|"); + for (j = i; j < MIN (i+16, len); ++j) + if (isprint (buf[j])) + printf ("%c", buf[j]); + else + printf ("."); + for (; j < i+16; ++j) + printf (" "); + printf ("|\n"); } } #endif @@ -147,11 +147,11 @@ main_loop (int _sock) end_us = (int64_t) end_t.tv_sec * 1000000 + end_t.tv_usec; elapsed_us = end_us - start_us; fprintf (stderr, "proc %d (%s) took %d.%02d seconds\n", - proc_nr, - proc_nr >= 0 && proc_nr < GUESTFS_PROC_NR_PROCS - ? function_names[proc_nr] : "UNKNOWN PROCEDURE", - (int) (elapsed_us / 1000000), - (int) ((elapsed_us / 10000) % 100)); + proc_nr, + proc_nr >= 0 && proc_nr < GUESTFS_PROC_NR_PROCS + ? function_names[proc_nr] : "UNKNOWN PROCEDURE", + (int) (elapsed_us / 1000000), + (int) ((elapsed_us / 10000) % 100)); } cont: @@ -317,7 +317,7 @@ receive_file (receive_cb cb, void *opaque) if (len > GUESTFS_MESSAGE_MAX) { fprintf (stderr, "guestfsd: incoming message is too long (%u bytes)\n", - len); + len); exit (1); } @@ -341,7 +341,7 @@ receive_file (receive_cb cb, void *opaque) if (verbose) printf ("receive_file: got chunk: cancel = %d, len = %d, buf = %p\n", - chunk.cancel, chunk.data.data_len, chunk.data.data_val); + chunk.cancel, chunk.data.data_len, chunk.data.data_val); if (chunk.cancel) { fprintf (stderr, "receive_file: received cancellation from library\n"); @@ -397,7 +397,7 @@ send_file_write (const void *buf, int len) if (len > GUESTFS_MAX_CHUNK_SIZE) { fprintf (stderr, "send_file_write: len (%d) > GUESTFS_MAX_CHUNK_SIZE (%d)\n", - len, GUESTFS_MAX_CHUNK_SIZE); + len, GUESTFS_MAX_CHUNK_SIZE); return -1; } @@ -455,7 +455,7 @@ check_for_library_cancellation (void) if (flag != GUESTFS_CANCEL_FLAG) { fprintf (stderr, "check_for_library_cancellation: read 0x%x from library, expected 0x%x\n", - flag, GUESTFS_CANCEL_FLAG); + flag, GUESTFS_CANCEL_FLAG); return 0; } diff --git a/daemon/readdir.c b/daemon/readdir.c index e3851db4..17fc6190 100644 --- a/daemon/readdir.c +++ b/daemon/readdir.c @@ -63,7 +63,7 @@ do_readdir (char *path) guestfs_int_dirent *p; p = realloc (ret->guestfs_int_dirent_list_val, - sizeof (guestfs_int_dirent) * (i+1)); + sizeof (guestfs_int_dirent) * (i+1)); v.name = strdup (d->d_name); if (!p || !v.name) { reply_with_perror ("allocate"); diff --git a/daemon/sfdisk.c b/daemon/sfdisk.c index f512e26b..e06d0bf0 100644 --- a/daemon/sfdisk.c +++ b/daemon/sfdisk.c @@ -31,8 +31,8 @@ static int sfdisk (char *device, int n, int cyls, int heads, int sectors, - const char *extra_flag, - char * const* const lines) + const char *extra_flag, + char * const* const lines) { FILE *fp; char buf[256]; @@ -85,14 +85,14 @@ sfdisk (char *device, int n, int cyls, int heads, int sectors, int do_sfdisk (char *device, int cyls, int heads, int sectors, - char **lines) + char **lines) { return sfdisk (device, 0, cyls, heads, sectors, NULL, lines); } int do_sfdisk_N (char *device, int n, int cyls, int heads, int sectors, - char *line) + char *line) { const char *lines[2] = { line, NULL }; diff --git a/daemon/xattr.c b/daemon/xattr.c index 23b00d82..a908a44b 100644 --- a/daemon/xattr.c +++ b/daemon/xattr.c @@ -107,9 +107,9 @@ do_lremovexattr (char *xattr, char *path) static guestfs_int_xattr_list * getxattrs (char *path, - ssize_t (*listxattr) (const char *path, char *list, size_t size), - ssize_t (*getxattr) (const char *path, const char *name, - void *value, size_t size)) + ssize_t (*listxattr) (const char *path, char *list, size_t size), + ssize_t (*getxattr) (const char *path, const char *name, + void *value, size_t size)) { ssize_t len, vlen; char *buf = NULL; @@ -175,15 +175,15 @@ getxattrs (char *path, r->guestfs_int_xattr_list_val[j].attrval.attrval_len = vlen; if (r->guestfs_int_xattr_list_val[j].attrname == NULL || - r->guestfs_int_xattr_list_val[j].attrval.attrval_val == NULL) { + r->guestfs_int_xattr_list_val[j].attrval.attrval_val == NULL) { reply_with_perror ("malloc"); goto error; } CHROOT_IN; vlen = getxattr (path, &buf[i], - r->guestfs_int_xattr_list_val[j].attrval.attrval_val, - vlen); + r->guestfs_int_xattr_list_val[j].attrval.attrval_val, + vlen); CHROOT_OUT; if (vlen == -1) { reply_with_perror ("getxattr"); @@ -200,8 +200,8 @@ getxattrs (char *path, if (r) { if (r->guestfs_int_xattr_list_val) for (i = 0; i < r->guestfs_int_xattr_list_len; ++i) { - free (r->guestfs_int_xattr_list_val[i].attrname); - free (r->guestfs_int_xattr_list_val[i].attrval.attrval_val); + free (r->guestfs_int_xattr_list_val[i].attrname); + free (r->guestfs_int_xattr_list_val[i].attrval.attrval_val); } free (r->guestfs_int_xattr_list_val); } @@ -211,8 +211,8 @@ getxattrs (char *path, static int _setxattr (char *xattr, char *val, int vallen, char *path, - int (*setxattr) (const char *path, const char *name, - const void *value, size_t size, int flags)) + int (*setxattr) (const char *path, const char *name, + const void *value, size_t size, int flags)) { int r; @@ -229,7 +229,7 @@ _setxattr (char *xattr, char *val, int vallen, char *path, static int _removexattr (char *xattr, char *path, - int (*removexattr) (const char *path, const char *name)) + int (*removexattr) (const char *path, const char *name)) { int r; |