Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/mail PR/47577: Steffen "Daode" Nurpmeso: Refinement ...



details:   https://anonhg.NetBSD.org/src/rev/975513f37ee7
branches:  trunk
changeset: 785063:975513f37ee7
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Feb 20 14:38:13 2013 +0000

description:
PR/47577: Steffen "Daode" Nurpmeso: Refinement to previous to keep always
keep track of the folder when it is updated.

diffstat:

 usr.bin/mail/fio.c |  20 ++++++++++----------
 usr.bin/mail/lex.c |  11 ++++++-----
 2 files changed, 16 insertions(+), 15 deletions(-)

diffs (88 lines):

diff -r 49e86bfd09ce -r 975513f37ee7 usr.bin/mail/fio.c
--- a/usr.bin/mail/fio.c        Wed Feb 20 14:13:31 2013 +0000
+++ b/usr.bin/mail/fio.c        Wed Feb 20 14:38:13 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fio.c,v 1.37 2013/02/19 17:43:32 christos Exp $        */
+/*     $NetBSD: fio.c,v 1.38 2013/02/20 14:38:13 christos Exp $        */
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)fio.c      8.2 (Berkeley) 4/20/95";
 #else
-__RCSID("$NetBSD: fio.c,v 1.37 2013/02/19 17:43:32 christos Exp $");
+__RCSID("$NetBSD: fio.c,v 1.38 2013/02/20 14:38:13 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -397,15 +397,15 @@
 
        if ((folder = value(ENAME_FOLDER)) == NULL)
                return -1;
-       if (*folder == '/')
-               (void)strlcpy(unres, folder, sizeof(unres));
-       else
+       if (*folder != '/') {
                (void)snprintf(unres, sizeof(unres), "%s/%s", homedir, folder);
-       if (realpath(unres, res) == NULL) {
-               warn("Can't canonicalize folder `%s'", unres);
-               (void)strlcpy(name, unres, namesize);
-       } else
-               (void)strlcpy(name, res, namesize);
+               folder = unres;
+       }
+       if (realpath(folder, res) == NULL)
+               warn("Can't canonicalize folder `%s'", folder);
+       else
+               folder = res;
+       (void)strlcpy(name, folder, namesize);
        return 0;
 }
 
diff -r 49e86bfd09ce -r 975513f37ee7 usr.bin/mail/lex.c
--- a/usr.bin/mail/lex.c        Wed Feb 20 14:13:31 2013 +0000
+++ b/usr.bin/mail/lex.c        Wed Feb 20 14:38:13 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lex.c,v 1.42 2013/02/19 17:43:32 christos Exp $        */
+/*     $NetBSD: lex.c,v 1.43 2013/02/20 14:38:13 christos Exp $        */
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)lex.c      8.2 (Berkeley) 4/20/95";
 #else
-__RCSID("$NetBSD: lex.c,v 1.42 2013/02/19 17:43:32 christos Exp $");
+__RCSID("$NetBSD: lex.c,v 1.43 2013/02/20 14:38:13 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -147,7 +147,8 @@
        char tbuf[PATHSIZE];
        size_t l;
 
-       if (realpath(name, mailname) == NULL) {
+       /* Don't realpath(3) if it's only an update request */
+       if (name != NULL && realpath(name, mailname) == NULL) {
                warn("Can't canonicalize `%s'", name);
                return;
        }
@@ -272,8 +273,7 @@
        shudclob = 1;
        edit = isedit;
        (void)strcpy(prevfile, mailname);
-       if (name != mailname)
-               update_mailname(name);
+       update_mailname(name != mailname ? name : NULL);
        mailsize = fsize(ibuf);
        (void)snprintf(tempname, sizeof(tempname),
            "%s/mail.RxXXXXXXXXXX", tmpdir);
@@ -1057,6 +1057,7 @@
        /*
         * Display the statistics.
         */
+       update_mailname(NULL);
        (void)printf("\"%s\": ", displayname);
        {
                int cnt = get_abs_msgCount();



Home | Main Index | Thread Index | Old Index