From 58d8534847bc23e3b476372c11b368e4020676f7 Mon Sep 17 00:00:00 2001 From: Stelian Pop Date: Wed, 29 Nov 2000 10:13:41 +0000 Subject: [PATCH] Dump -w|-W fixes --- CHANGES | 9 ++++++++- dump/optr.c | 24 +++++++++++++----------- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/CHANGES b/CHANGES index 8db1c09..bb5f3c8 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,11 @@ -$Id: CHANGES,v 1.90 2000/11/10 18:05:16 stelian Exp $ +$Id: CHANGES,v 1.91 2000/11/29 10:13:41 stelian Exp $ + +Changes between versions 0.4b20 and 0.4b21 (released ?????????????????) +======================================================================= + +1. Fixed some bugs in the dump -w|-W logic introduced by + the previous version. Thanks to Andreas Dilger + for his help on this one. Changes between versions 0.4b19 and 0.4b20 (released November 10, 2000) ======================================================================= diff --git a/dump/optr.c b/dump/optr.c index fd01cac..35ae3bd 100644 --- a/dump/optr.c +++ b/dump/optr.c @@ -41,7 +41,7 @@ #ifndef lint static const char rcsid[] = - "$Id: optr.c,v 1.14 2000/11/10 14:42:25 stelian Exp $"; + "$Id: optr.c,v 1.15 2000/11/29 10:13:43 stelian Exp $"; #endif /* not lint */ #include @@ -572,9 +572,12 @@ print_wmsg(char arg, int dumpme, const char *dev, int level, { char *date; - if (ddate) + if (ddate) { + char *d; date = (char *)ctime(&ddate); - //date[16] = '\0'; /* blast away seconds and year */ + d = strchr(date, '\n'); + if (d) *d = '\0'; + } if (!dumpme && arg == 'w') return; @@ -628,8 +631,7 @@ lastdump(char arg) /* w ==> just what to do; W ==> most recent dumps */ sizeof(dtwalk->dd_name)) == 0) continue; lastname = dtwalk->dd_name; - if ((dt = dtwalk->dd_fstab) != NULL && - dt->fs_freq != 0) { + if ((dt = dtwalk->dd_fstab) != NULL) { /* Overload fs_freq as dump level and * fs_passno as date, because we can't * change struct fstab format. @@ -637,11 +639,11 @@ lastdump(char arg) /* w ==> just what to do; W ==> most recent dumps */ * filesystem needs to be dumped. */ dt->fs_passno = dtwalk->dd_ddate; - if (dtwalk->dd_ddate < - tnow - (dt->fs_freq * 86400)) - dt->fs_freq = -dtwalk->dd_level; + if (dt->fs_freq > 0 && (dtwalk->dd_ddate < + tnow - (dt->fs_freq * 86400))) + dt->fs_freq = -dtwalk->dd_level - 1; else - dt->fs_freq = dtwalk->dd_level; + dt->fs_freq = dtwalk->dd_level + 1; } } @@ -656,9 +658,9 @@ lastdump(char arg) /* w ==> just what to do; W ==> most recent dumps */ if (strncmp(dt->fs_vfstype, *type, sizeof(dt->fs_vfstype)) == 0) { const char *disk = get_device_name(dt->fs_spec); - print_wmsg(arg, dt->fs_freq < 0 || !dt->fs_passno, + print_wmsg(arg, dt->fs_freq < 0, disk ? disk : dt->fs_spec, - dt->fs_freq < 0 ? -dt->fs_freq : dt->fs_freq, + dt->fs_freq < 0 ? -dt->fs_freq - 1 : dt->fs_freq - 1, dt->fs_file, dt->fs_passno); } -- 2.39.5