]> git.proxmox.com Git - efi-boot-shim.git/blobdiff - buildid.c
Force usage of newest revocations at build time
[efi-boot-shim.git] / buildid.c
index b27aa1fe430a7f71fb48f425f34b2fb9024df26d..ba7950fcc4f94031845706409903fea5de0173e8 100644 (file)
--- a/buildid.c
+++ b/buildid.c
@@ -1,8 +1,8 @@
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+
 /*
  * Walk a list of input files, printing the name and buildid of any file
  * that has one.
- *
- * This program is licensed under the GNU Public License version 2.
  */
 
 #include <err.h>
@@ -113,6 +113,7 @@ static void handle_one(char *f)
        char *b = NULL;
        size_t sz;
        uint8_t *data;
+       ssize_t written;
 
        if (!strcmp(f, "-")) {
                fd = STDIN_FILENO;
@@ -132,10 +133,14 @@ static void handle_one(char *f)
                b = alloca(sz * 2 + 1);
                data2hex(data, sz, b);
                if (b) {
-                       write(1, f, strlen(f));
-                       write(1, " ", 1);
-                       write(1, b, strlen(b));
-                       write(1, "\n", 1);
+                       written = write(1, f, strlen(f));
+                       if (written < 0)
+                               errx(1, "Error writing build id");
+                       written = write(1, " ", 1);
+                       written = write(1, b, strlen(b));
+                       if (written < 0)
+                               errx(1, "Error writing build id");
+                       written = write(1, "\n", 1);
                }
        }
        elf_end(elf);