Author: mckusick
Date: Fri Jan 13 07:08:21 2012
New Revision: 230047
URL: http://svn.freebsd.org/changeset/base/230047

Log:
  MFC: 226520
  
  The current /etc/dumpdates file restricts device names to 32 characters.
  With the addition of various GEOM layers some device names now exceed
  this length, for example /dev/mirror/encrypted.elig.journal. This
  change expands the field to 53 bytes which brings the /etc/dumpdates
  lines to 80 characters. Exceeding 80 characters makes the /etc/dumpdates
  file much less human readable. A test is added to dump so that it
  verifies that the device name will fit in the 53 character field
  failing the dump if it is too long.
  
  This change has been checked to verify that its /etc/dumpdates file
  is compatible with older versions of dump.
  
  Reported by: Martin Sugioarto <mar...@sugioarto.com>
  PR:          kern/160678

Modified:
  stable/9/sbin/dump/dump.h
  stable/9/sbin/dump/itime.c
Directory Properties:
  stable/9/sbin/dump/   (props changed)

Modified: stable/9/sbin/dump/dump.h
==============================================================================
--- stable/9/sbin/dump/dump.h   Fri Jan 13 07:00:47 2012        (r230046)
+++ stable/9/sbin/dump/dump.h   Fri Jan 13 07:08:21 2012        (r230047)
@@ -171,9 +171,10 @@ void       putdumptime(void);
        if (ddatev != NULL) \
                for (ddp = ddatev[i = 0]; i < nddates; ddp = ddatev[++i])
 
-#define        DUMPOUTFMT      "%-32s %d %s"           /* for printf */
+#define        DUMPFMTLEN      53                      /* max device pathname 
length */
+#define        DUMPOUTFMT      "%-*s %d %s"            /* for printf */
                                                /* name, level, ctime(date) */
-#define        DUMPINFMT       "%32s %d %[^\n]\n"      /* inverse for scanf */
+#define        DUMPINFMT       "%s %d %[^\n]\n"        /* inverse for scanf */
 
 void   sig(int signo);
 

Modified: stable/9/sbin/dump/itime.c
==============================================================================
--- stable/9/sbin/dump/itime.c  Fri Jan 13 07:00:47 2012        (r230046)
+++ stable/9/sbin/dump/itime.c  Fri Jan 13 07:08:21 2012        (r230047)
@@ -222,7 +222,10 @@ static void
 dumprecout(FILE *file, const struct dumpdates *what)
 {
 
-       if (fprintf(file, DUMPOUTFMT, what->dd_name,
+       if (strlen(what->dd_name) > DUMPFMTLEN)
+               quit("Name '%s' exceeds DUMPFMTLEN (%d) bytes\n",
+                   what->dd_name, DUMPFMTLEN);
+       if (fprintf(file, DUMPOUTFMT, DUMPFMTLEN, what->dd_name,
              what->dd_level, ctime(&what->dd_ddate)) < 0)
                quit("%s: %s\n", dumpdates, strerror(errno));
 }
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to