PR/47577: Steffen "Daode" Nurpmeso: Refinement to previous to keep always

keep track of the folder when it is updated.
This commit is contained in:
christos 2013-02-20 14:38:13 +00:00
parent 763d7bc79a
commit 3157acd0cf
2 changed files with 16 additions and 15 deletions

View File

@ -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 @@ getfold(char *name, size_t namesize)
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;
}

View File

@ -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 @@ update_mailname(const char *name)
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 @@ setfile(const char *name)
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 @@ newfileinfo(int omsgCount)
/*
* Display the statistics.
*/
update_mailname(NULL);
(void)printf("\"%s\": ", displayname);
{
int cnt = get_abs_msgCount();