pkgsrc/mail/cyrus-imapd/patches/patch-aq
obache 05cb918a7b Fixes `-n' option handling for fetchnews(1).
Patch provided by Jukka Salmi in PR 41432.

While here, add DESTDIR support.
2009-05-15 23:29:01 +00:00

48 lines
1.5 KiB
Text

$NetBSD: patch-aq,v 1.4 2009/05/15 23:29:01 obache Exp $
--- imap/fetchnews.c.orig 2005-03-23 00:40:11.000000000 +0000
+++ imap/fetchnews.c
@@ -268,7 +268,7 @@ int main(int argc, char *argv[])
if (geteuid() == 0) fatal("must run as the Cyrus user", EC_USAGE);
- while ((opt = getopt(argc, argv, "C:s:w:f:a:p:n:y")) != EOF) {
+ while ((opt = getopt(argc, argv, "C:s:w:f:a:p:ny")) != EOF) {
switch (opt) {
case 'C': /* alt config file */
alt_config = optarg;
@@ -371,7 +371,8 @@ int main(int argc, char *argv[])
prot_fgets(buf, sizeof(buf), pin);
if (newnews) {
- struct tm ctime, *ptime;
+ struct tm ctime, ptime, ltime;
+ time_t l_time, l_gmt;
/* fetch the server's current time */
prot_printf(pout, "DATE\r\n");
@@ -416,8 +417,11 @@ int main(int argc, char *argv[])
/* ask for new articles */
if (stamp) stamp -= 180; /* adjust back 3 minutes */
- ptime = gmtime(&stamp);
- strftime(buf, sizeof(buf), datefmt, ptime);
+ gmtime_r(&stamp, &ptime);
+ localtime_r(&stamp, &ltime);
+ l_gmt = mktime(&ptime);
+ l_time = mktime(&ltime);;
+ strftime(buf, sizeof(buf), datefmt, &ptime);
prot_printf(pout, "NEWNEWS %s %s GMT\r\n", wildmat, buf);
if (!prot_fgets(buf, sizeof(buf), pin) || strncmp("230", buf, 3)) {
@@ -433,7 +437,9 @@ int main(int argc, char *argv[])
We can't change this, otherwise we'd be incompatible
with an old localtime timestamp.
*/
- stamp -= timezone;
+ stamp += l_time - l_gmt;
+ if (ltime.tm_isdst)
+ stamp += 3600;
}
if (!newnews) {