Fix utime() usage for modern glibc

This commit is contained in:
2025-12-14 11:48:10 +01:00
parent cab1094665
commit f7567c5512
6 changed files with 53 additions and 32 deletions

View File

@@ -300,7 +300,7 @@ int mbx_isvalid (MAILSTREAM **stream,char *name,char *tmp,int *ld,char *lock,
if (sbuf.st_ctime > sbuf.st_atime) {
tp[0] = sbuf.st_atime; /* preserve atime and mtime */
tp[1] = sbuf.st_mtime;
utime (tmp,tp); /* set the times */
set_utime_from_tp (tmp,tp); /* set the times */
}
}
/* in case INBOX but not mbx format */
@@ -774,7 +774,7 @@ void mbx_flag (MAILSTREAM *stream,char *sequence,char *flag,long flags)
stream->user_flags[LOCAL->ffuserflag]) || (oldpid != LOCAL->lastpid))
mbx_update_header (stream);
tp[0] = time (0); /* make sure read comes after all that */
utime (stream->mailbox,tp);
set_utime_from_tp(stream->mailbox,tp);
}
if (LOCAL->ld >= 0) { /* unlock now */
unlockfd (LOCAL->ld,LOCAL->lock);
@@ -1073,7 +1073,7 @@ long mbx_copy (MAILSTREAM *stream,char *sequence,char *mailbox,long options)
/* else preserve \Marked status */
else tp[0] = (sbuf.st_ctime > sbuf.st_atime) ? sbuf.st_atime : time(0);
tp[1] = sbuf.st_mtime; /* preserve mtime */
utime (file,tp); /* set the times */
set_utime_from_tp(file,tp); /* set the times */
close (fd); /* close the file */
MM_NOCRITICAL (stream); /* release critical */
unlockfd (ld,lock); /* release exclusive parse/append permission */
@@ -1211,7 +1211,7 @@ long mbx_append (MAILSTREAM *stream,char *mailbox,append_t af,void *data)
/* else preserve \Marked status */
else tp[0] = (sbuf.st_ctime > sbuf.st_atime) ? sbuf.st_atime : time(0);
tp[1] = sbuf.st_mtime; /* preserve mtime */
utime (file,tp); /* set the times */
set_utime_from_tp(file,tp); /* set the times */
fclose (df); /* close the file */
MM_NOCRITICAL (dstream); /* release critical */
}
@@ -1444,7 +1444,7 @@ long mbx_parse (MAILSTREAM *stream)
time_t tp[2];
tp[0] = time (0);
tp[1] = LOCAL->filetime;
utime (stream->mailbox,tp);
set_utime_from_tp(stream->mailbox,tp);
}
stream->silent = silent; /* can pass up events now */
mail_exists (stream,nmsgs); /* notify upper level of new mailbox size */
@@ -1812,7 +1812,7 @@ unsigned long mbx_rewrite (MAILSTREAM *stream,unsigned long *reclaimed,
fstat (LOCAL->fd,&sbuf); /* get new write time */
tp[1] = LOCAL->filetime = sbuf.st_mtime;
tp[0] = time (0); /* reset atime to now */
utime (stream->mailbox,tp);
set_utime_from_tp(stream->mailbox,tp);
unlockfd (ld,lock); /* release exclusive parse/append permission */
/* notify upper level of new mailbox size */
mail_exists (stream,stream->nmsgs);