The log(pri, "") triggers a 'zero-length kprintf format string' warning which causes gcc to error out despite -Wno-error=format.

OK to commit this patch?


--- sys/kern/subr_disk.c
+++ sys/kern/subr_disk.c
@@ -761,13 +761,14 @@ diskerr(struct buf *bp, char *dname, char *what, int pri, 
int blkdone,
        daddr64_t sn;

        if (pri != LOG_PRINTF) {
-               static const char fmt[] = "";
-               log(pri, fmt);
+               log(pri, "%s%d%c: %s %sing fsbn ", dname, unit, partname, what,
+                   bp->b_flags & B_READ ? "read" : "writ");
                pr = addlog;
-       } else
+       } else {
+               printf("%s%d%c: %s %sing fsbn ", dname, unit, partname, what,
+                   bp->b_flags & B_READ ? "read" : "writ");
                pr = printf;
-       (*pr)("%s%d%c: %s %sing fsbn ", dname, unit, partname, what,
-           bp->b_flags & B_READ ? "read" : "writ");
+       }
        sn = bp->b_blkno;
        if (bp->b_bcount <= DEV_BSIZE)
                (*pr)("%lld", sn);

Reply via email to