]> granicus.if.org Git - file/commitdiff
eliminate non-literal format strings.
authorChristos Zoulas <christos@zoulas.com>
Sun, 14 Aug 2011 09:03:12 +0000 (09:03 +0000)
committerChristos Zoulas <christos@zoulas.com>
Sun, 14 Aug 2011 09:03:12 +0000 (09:03 +0000)
src/fsmagic.c
src/print.c

index da0ea8d2bf72053ff6ab099a60a9f2d30ad6ed1b..7200271fc69a01456ebc51448af01543ddb07ba1 100644 (file)
@@ -32,7 +32,7 @@
 #include "file.h"
 
 #ifndef        lint
-FILE_RCSID("@(#)$File: fsmagic.c,v 1.63 2011/07/12 11:31:59 rrt Exp $")
+FILE_RCSID("@(#)$File: fsmagic.c,v 1.64 2011/08/14 09:03:12 christos Exp $")
 #endif /* lint */
 
 #include "magic.h"
@@ -63,22 +63,18 @@ FILE_RCSID("@(#)$File: fsmagic.c,v 1.63 2011/07/12 11:31:59 rrt Exp $")
 private int
 bad_link(struct magic_set *ms, int err, char *buf)
 {
-       const char *errfmt;
        int mime = ms->flags & MAGIC_MIME;
        if ((mime & MAGIC_MIME_TYPE) &&
            file_printf(ms, "inode/symlink")
            == -1)
                return -1;
        else if (!mime) {
-               if (err == ELOOP)
-                       errfmt = "symbolic link in a loop";
-               else
-                       errfmt = "broken symbolic link to `%s'";
                if (ms->flags & MAGIC_ERROR) {
-                       file_error(ms, err, errfmt, buf);
+                       file_error(ms, err,
+                                  "broken symbolic link to `%s'", buf);
                        return -1;
                } 
-               if (file_printf(ms, errfmt, buf) == -1)
+               if (file_printf(ms, "broken symbolic link to `%s'", buf) == -1)
                        return -1;
        }
        return 1;
index 5be8c767f3783ecb23eb7f4f35db7e7568668bb5..3bc4d85322146ff032c713b5db5eda2afbc62996 100644 (file)
@@ -32,7 +32,7 @@
 #include "file.h"
 
 #ifndef lint
-FILE_RCSID("@(#)$File: print.c,v 1.69 2010/07/21 16:47:18 christos Exp $")
+FILE_RCSID("@(#)$File: print.c,v 1.70 2011/08/14 09:03:12 christos Exp $")
 #endif  /* lint */
 
 #include <string.h>
@@ -51,8 +51,7 @@ file_mdump(struct magic *m)
 {
        private const char optyp[] = { FILE_OPS };
 
-       (void) fprintf(stderr, "[%u", m->lineno);
-       (void) fprintf(stderr, ">>>>>>>> %u" + 8 - (m->cont_level & 7),
+       (void) fprintf(stderr, "%.*s %u", (m->cont_level & 7) + 1, ">>>>>>>>",
                       m->offset);
 
        if (m->flag & INDIR) {