[Pkg-libvirt-commits] [libguestfs] 106/179: ls: in CSV mode, always have a checksum field (RHBZ#1151900).

Hilko Bengen bengen at moszumanska.debian.org
Fri Oct 31 19:08:44 UTC 2014


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to branch experimental
in repository libguestfs.

commit e5befcacc5f7c1a6bd67fcdb92afede1a82d50eb
Author: Pino Toscano <ptoscano at redhat.com>
Date:   Mon Oct 13 15:51:34 2014 +0200

    ls: in CSV mode, always have a checksum field (RHBZ#1151900).
    
    Make sure to output the field for checksum even for non-regular files,
    as empty, in CSV output mode. This ensures each line has the same number
    of fields, regardless of the file type.
---
 cat/ls.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/cat/ls.c b/cat/ls.c
index de8248e..2cb4e74 100644
--- a/cat/ls.c
+++ b/cat/ls.c
@@ -524,12 +524,15 @@ show_file (const char *dir, const char *name,
 
   path = full_path (dir, name);
 
-  if (checksum && is_reg (stat->st_mode)) {
-    csum = guestfs_checksum (g, checksum, path);
-    if (!csum)
-      exit (EXIT_FAILURE);
+  if (checksum) {
+    if (is_reg (stat->st_mode)) {
+      csum = guestfs_checksum (g, checksum, path);
+      if (!csum)
+        exit (EXIT_FAILURE);
 
-    output_string (csum);
+      output_string (csum);
+    } else if (csv)
+      output_string ("");
   }
 
   output_string (path);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list