[syslinux] [PATCH] mtools/syslinux.c: Silence warnings

Gene Cumm gene.cumm at gmail.com
Sat Jun 19 05:27:26 PDT 2010


From: Gene Cumm <gene.cumm at gmail.com>

mtools/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/mtools/syslinux.c b/mtools/syslinux.c
index 2b82b33..3307833 100644
--- a/mtools/syslinux.c
+++ b/mtools/syslinux.c
@@ -142,6 +142,7 @@ int main(int argc, char *argv[])
     const char *errmsg;
     int ldlinux_sectors, patch_sectors;
     int i;
+    int ret;

     int force = 0;             /* -f (force) option */
     int stupid = 0;            /* -s (stupid) option */
@@ -240,7 +241,7 @@ int main(int argc, char *argv[])
     }

     /* This command may fail legitimately */
-    system("mattrib -h -r -s s:/ldlinux.sys 2>/dev/null");
+    ret = system("mattrib -h -r -s s:/ldlinux.sys 2>/dev/null");

     mtp = popen("mcopy -D o -D O -o - s:/ldlinux.sys", "w");
     if (!mtp || (fwrite(syslinux_ldlinux, 1, syslinux_ldlinux_len, mtp)
@@ -313,7 +314,7 @@ int main(int argc, char *argv[])

        /* This command may fail legitimately */
        sprintf(command, "mattrib -h -r -s %s 2>/dev/null", target_file);
-       system(command);
+       ret = system(command);

        sprintf(command, "mmove -D o -D O s:/ldlinux.sys %s", target_file);
        status = system(command);




More information about the Syslinux mailing list