Instead of using pure atimes, I think we should generally use
[sgt/agedu] / agedu.c
diff --git a/agedu.c b/agedu.c
index 5b836e7..99fa1f8 100644 (file)
--- a/agedu.c
+++ b/agedu.c
@@ -90,7 +90,7 @@ static int gotdata(void *vctx, const char *pathname, const STRUCT_STAT *st)
     if (ctx->usemtime || (ctx->fakeatimes && S_ISDIR(st->st_mode)))
        file.atime = st->st_mtime;
     else
-       file.atime = st->st_atime;
+       file.atime = max(st->st_mtime, st->st_atime);
 
     /*
      * Filter based on wildcards.
@@ -949,7 +949,9 @@ int main(int argc, char **argv)
            ctx->progress = progress;
            {
                struct winsize ws;
-               if (progress && ioctl(2, TIOCGWINSZ, &ws) == 0)
+               if (progress &&
+                   ioctl(2, TIOCGWINSZ, &ws) == 0 &&
+                   ws.ws_col > 0)
                    ctx->progwidth = ws.ws_col - 1;
                else
                    ctx->progwidth = 79;