public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: net-libs/c-client/files/, net-libs/c-client/
@ 2016-10-09 16:19 Pacho Ramos
  0 siblings, 0 replies; 3+ messages in thread
From: Pacho Ramos @ 2016-10-09 16:19 UTC (permalink / raw
  To: gentoo-commits

commit:     82a9c67b930581ce132fda5e15f675e5d2c816cd
Author:     Pacho Ramos <pacho <AT> gentoo <DOT> org>
AuthorDate: Sun Oct  9 16:06:00 2016 +0000
Commit:     Pacho Ramos <pacho <AT> gentoo <DOT> org>
CommitDate: Sun Oct  9 16:19:01 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=82a9c67b

net-libs/c-client: Support libressl (#595328)

Package-Manager: portage-2.3.1

 net-libs/c-client/c-client-2007f-r5.ebuild         | 137 +++++++++++++++++++++
 .../c-client/files/c-client-2007f-ldflags.patch    |   4 +-
 net-libs/c-client/files/c-client-2007f-topal.patch |   8 +-
 3 files changed, 143 insertions(+), 6 deletions(-)

diff --git a/net-libs/c-client/c-client-2007f-r5.ebuild b/net-libs/c-client/c-client-2007f-r5.ebuild
new file mode 100644
index 00000000..d5a3ee6
--- /dev/null
+++ b/net-libs/c-client/c-client-2007f-r5.ebuild
@@ -0,0 +1,137 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+inherit flag-o-matic eutils libtool toolchain-funcs multilib
+
+MY_PN=imap
+MY_P="${MY_PN}-${PV}"
+S=${WORKDIR}/${MY_P}
+
+CHAPPA_PL=115
+DESCRIPTION="UW IMAP c-client library"
+HOMEPAGE="http://www.washington.edu/imap/"
+SRC_URI="ftp://ftp.cac.washington.edu/imap/${MY_P}.tar.Z
+	chappa? ( mirror://gentoo/${P}-chappa-${CHAPPA_PL}-all.patch.gz )"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd"
+IUSE="doc +ipv6 kerberos kernel_linux kernel_FreeBSD libressl pam ssl static-libs topal chappa"
+
+RDEPEND="
+	ssl? (
+		!libressl? ( dev-libs/openssl:0= )
+		libressl? ( dev-libs/libressl:0= ) )
+	!net-mail/uw-imap
+	kerberos? ( app-crypt/mit-krb5 )
+"
+DEPEND="${RDEPEND}
+	kernel_linux? ( pam? ( >=sys-libs/pam-0.72 ) )
+"
+
+src_prepare() {
+	default
+
+	# Tarball packed with bad file perms
+	chmod -R u+rwX,go-w .
+
+	# lots of things need -fPIC, including various platforms, and this library
+	# generally should be built with it anyway.
+	append-flags -fPIC
+
+	# Modifications so we can build it optimally and correctly
+	sed \
+		-e "s:BASECFLAGS=\".*\":BASECFLAGS=:g" \
+		-e 's:SSLDIR=/usr/local/ssl:SSLDIR=/usr:g' \
+		-e 's:SSLCERTS=$(SSLDIR)/certs:SSLCERTS=/etc/ssl/certs:g' \
+		-i src/osdep/unix/Makefile || die "Makefile sed fixing failed"
+
+	# Make the build system more multilib aware
+	sed \
+		-e "s:^SSLLIB=\$(SSLDIR)/lib:SSLLIB=\$(SSLDIR)/$(get_libdir):" \
+		-e "s:^AFSLIB=\$(AFSDIR)/lib:AFSLIB=\$(AFSDIR)/$(get_libdir):" \
+		-i src/osdep/unix/Makefile || die "Makefile sed fixing failed"
+
+	# Targets should use the Gentoo (ie linux) fs
+	sed -e '/^bsf:/,/^$/ s:ACTIVEFILE=.*:ACTIVEFILE=/var/lib/news/active:g' \
+		-i src/osdep/unix/Makefile || die "Makefile sex fixing failed for FreeBSD"
+
+	# Apply a patch to only build the stuff we need for c-client
+	eapply "${FILESDIR}"/${PN}-2006k_GENTOO_Makefile.patch
+
+	# Apply patch to add the compilation of a .so for PHP
+	# This was previously conditional, but is more widely useful.
+	eapply "${FILESDIR}"/${PN}-2006k_GENTOO_amd64-so-fix.patch
+
+	# Remove the pesky checks about SSL stuff
+	sed -e '/read.*exit/d' -i Makefile || die
+
+	# Respect LDFLAGS
+	eapply "${FILESDIR}"/${PN}-2007f-ldflags.patch
+	sed -e "s/CC=cc/CC=$(tc-getCC)/" \
+		-e "s/ARRC=ar/ARRC=$(tc-getAR)/" \
+		-e "s/RANLIB=ranlib/RANLIB=$(tc-getRANLIB)/" \
+		-i src/osdep/unix/Makefile || die "Respecting build flags"
+
+	use topal && eapply "${FILESDIR}/${P}-topal.patch"
+	use chappa && eapply "${DISTDIR}/${P}-chappa-${CHAPPA_PL}-all.patch.gz"
+
+	elibtoolize
+}
+
+src_compile() {
+	local mymake ipver ssltype target passwdtype
+	ipver='IP=4'
+	use ipv6 && ipver="IP=6" && touch ip6
+	use ssl && ssltype="unix" || ssltype="none"
+	if use kernel_linux ; then
+		use pam && target=lnp passwdtype=pam || target=lnx passwdtype=std
+	elif use kernel_FreeBSD ; then
+		target=bsf passwdtype=pam
+	fi
+	use kerberos \
+		&& mymake="EXTRAAUTHENTICATORS=gss" \
+		&& EXTRALIBS="-lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err" \
+	# no parallel builds supported!
+	emake -j1 SSLTYPE=${ssltype} $target \
+		PASSWDTYPE=${passwdtype} ${ipver} ${mymake} \
+		EXTRACFLAGS="${CFLAGS}" \
+		EXTRALDFLAGS="${LDFLAGS}" \
+		EXTRALIBS="${EXTRALIBS}" \
+		GSSDIR=/usr
+}
+
+src_install() {
+	if use static-libs; then
+		# Library binary
+		dolib.a c-client/c-client.a
+		dosym c-client.a /usr/$(get_libdir)/libc-client.a
+	fi
+
+	# Now the shared library
+	dolib.so c-client/libc-client.so.1.0.0
+
+	dosym libc-client.so.1.0.0 /usr/$(get_libdir)/libc-client.so
+	dosym libc-client.so.1.0.0 /usr/$(get_libdir)/libc-client.so.1
+
+	# Headers
+	insinto /usr/include/imap
+	doins src/osdep/unix/*.h
+	doins src/c-client/*.h
+	doins c-client/linkage.h
+	doins c-client/linkage.c
+	doins c-client/osdep.h
+	if use ssl; then
+		echo "  ssl_onceonlyinit ();" >> "${D}"/usr/include/imap/linkage.c || die
+	fi
+	# Docs
+	dodoc README docs/*.txt docs/BUILD docs/CONFIG docs/RELNOTES docs/SSLBUILD
+	if use doc; then
+		docinto rfc
+		dodoc docs/rfc/*.txt
+		docinto draft
+		dodoc docs/draft/*
+	fi
+}

diff --git a/net-libs/c-client/files/c-client-2007f-ldflags.patch b/net-libs/c-client/files/c-client-2007f-ldflags.patch
index 5c143b7..2f1cf50 100644
--- a/net-libs/c-client/files/c-client-2007f-ldflags.patch
+++ b/net-libs/c-client/files/c-client-2007f-ldflags.patch
@@ -1,5 +1,5 @@
---- src/osdep/unix/Makefile~	2011-06-07 16:04:29.000000000 +0300
-+++ src/osdep/unix/Makefile	2011-06-07 15:55:31.000000000 +0300
+--- a/src/osdep/unix/Makefile~	2011-06-07 16:04:29.000000000 +0300
++++ b/src/osdep/unix/Makefile	2011-06-07 15:55:31.000000000 +0300
 @@ -954,23 +954,24 @@
  
  # Once-only environment setup

diff --git a/net-libs/c-client/files/c-client-2007f-topal.patch b/net-libs/c-client/files/c-client-2007f-topal.patch
index 2b5db04..b15fa4e 100644
--- a/net-libs/c-client/files/c-client-2007f-topal.patch
+++ b/net-libs/c-client/files/c-client-2007f-topal.patch
@@ -1,6 +1,6 @@
 diff -cr alpine-2.00.orig/imap/src/c-client/mail.h alpine-2.00.new/imap/src/c-client/mail.h
-*** src/c-client/mail.h	2008-08-08 18:34:22.000000000 +0100
---- src/c-client/mail.h	2009-05-01 13:40:37.000000000 +0100
+*** a/src/c-client/mail.h	2008-08-08 18:34:22.000000000 +0100
+--- b/src/c-client/mail.h	2009-05-01 13:40:37.000000000 +0100
 ***************
 *** 775,780 ****
 --- 775,781 ----
@@ -12,8 +12,8 @@ diff -cr alpine-2.00.orig/imap/src/c-client/mail.h alpine-2.00.new/imap/src/c-cl
   };
   
 diff -cr alpine-2.00.orig/imap/src/c-client/mail.c alpine-2.00.new/imap/src/c-client/mail.c
-*** src/c-client/mail.c	2008-06-04 19:39:54.000000000 +0100
---- src/c-client/mail.c	2009-04-30 22:34:13.000000000 +0100
+*** a/src/c-client/mail.c	2008-06-04 19:39:54.000000000 +0100
+--- b/src/c-client/mail.c	2009-04-30 22:34:13.000000000 +0100
 ***************
 *** 2712,2717 ****
 --- 2712,2719 ----


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: net-libs/c-client/files/, net-libs/c-client/
@ 2022-10-07 11:28 Sam James
  0 siblings, 0 replies; 3+ messages in thread
From: Sam James @ 2022-10-07 11:28 UTC (permalink / raw
  To: gentoo-commits

commit:     324b4dc522e9fed3f843e43c1c9c1f1256d14f96
Author:     Petr Vaněk <arkamar <AT> atlas <DOT> cz>
AuthorDate: Wed Oct  5 11:19:00 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Oct  7 11:28:00 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=324b4dc5

net-libs/c-client: fix clang-16 build issues

This fixes bug 870478 by applying two patches. First patch resolves
implicit function declaration issues by defining safe_lock function
prototype and adding utime.h missing include. The second patch corrects
function pointer types for callbacks used in scandir function.

Additionally:
- EAPI bumped to 8
- remove 3 years dead blocker net-mail/uw-imap, removed in commit
  6b4c9212b3da ("net-mail/uw-imap: Remove last-rited pkg")

Closes: https://bugs.gentoo.org/870478
Signed-off-by: Petr Vaněk <arkamar <AT> atlas.cz>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 net-libs/c-client/c-client-2007f-r8.ebuild         | 161 ++++++++++++++++++++
 .../c-client-2007f-implicit-declaration-fix.patch  |  34 +++++
 .../c-client-2007f-scandir-callback-types.patch    | 167 +++++++++++++++++++++
 3 files changed, 362 insertions(+)

diff --git a/net-libs/c-client/c-client-2007f-r8.ebuild b/net-libs/c-client/c-client-2007f-r8.ebuild
new file mode 100644
index 000000000000..40a809309c13
--- /dev/null
+++ b/net-libs/c-client/c-client-2007f-r8.ebuild
@@ -0,0 +1,161 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit flag-o-matic libtool toolchain-funcs
+
+MY_PN=imap
+MY_P="${MY_PN}-${PV}"
+S=${WORKDIR}/${MY_P}
+
+CHAPPA_PL=115
+DESCRIPTION="UW IMAP c-client library"
+HOMEPAGE="http://www.washington.edu/imap/"
+SRC_URI="ftp://ftp.cac.washington.edu/imap/${MY_P}.tar.Z
+	chappa? ( mirror://gentoo/${P}-chappa-${CHAPPA_PL}-all.patch.gz )"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+IUSE="doc +ipv6 kerberos pam ssl static-libs topal chappa"
+
+RDEPEND="
+	ssl? (
+		dev-libs/openssl:0=
+	)
+	kernel_linux? (
+		pam? ( >=sys-libs/pam-0.72 )
+		!pam? ( virtual/libcrypt:= )
+	)
+	kerberos? ( app-crypt/mit-krb5 )
+"
+DEPEND="${RDEPEND}"
+
+PATCHES=(
+	# Apply a patch to only build the stuff we need for c-client
+	"${FILESDIR}/${PN}-2006k_GENTOO_Makefile.patch"
+
+	# Apply patch to add the compilation of a .so for PHP
+	# This was previously conditional, but is more widely useful.
+	"${FILESDIR}/${PN}-2006k_GENTOO_amd64-so-fix.patch"
+
+	# Respect LDFLAGS
+	"${FILESDIR}/${PN}-2007f-ldflags.patch"
+
+	# openssl-1.1 build fix #647616
+	"${FILESDIR}/${PN}-2007f-openssl-1.1.patch"
+
+	# build fix for -Werror=implicit-function-declaration and
+	# incompatible function pointer types, bug #870478
+	"${FILESDIR}/${PN}-2007f-implicit-declaration-fix.patch"
+	"${FILESDIR}/${PN}-2007f-scandir-callback-types.patch"
+)
+
+src_prepare() {
+	use topal && PATCHES+=( "${FILESDIR}/${P}-topal.patch" )
+
+	default
+
+	use chappa && eapply -p2 "${WORKDIR}/${P}-chappa-${CHAPPA_PL}-all.patch"
+
+	# Tarball packed with bad file perms
+	chmod -R u+rwX,go-w . || die "failed to fix permissions"
+
+	# lots of things need -fPIC, including various platforms, and this library
+	# generally should be built with it anyway.
+	append-flags -fPIC
+
+	# Modifications so we can build it optimally and correctly
+	sed \
+		-e "s:BASECFLAGS=\".*\":BASECFLAGS=:g" \
+		-e 's:SSLDIR=/usr/local/ssl:SSLDIR=/usr:g' \
+		-e 's:SSLCERTS=$(SSLDIR)/certs:SSLCERTS=/etc/ssl/certs:g' \
+		-i src/osdep/unix/Makefile \
+		|| die "failed to fix compiler flags and SSL paths in the Makefile"
+
+	# Make the build system more multilib aware
+	sed \
+		-e "s:^SSLLIB=\$(SSLDIR)/lib:SSLLIB=\$(SSLDIR)/$(get_libdir):" \
+		-e "s:^AFSLIB=\$(AFSDIR)/lib:AFSLIB=\$(AFSDIR)/$(get_libdir):" \
+		-i src/osdep/unix/Makefile \
+		|| die "failed to fix our libdir in the Makefile"
+
+	# Targets should use the Gentoo (ie linux) fs
+	sed -e '/^bsf:/,/^$/ s:ACTIVEFILE=.*:ACTIVEFILE=/var/lib/news/active:g' \
+		-i src/osdep/unix/Makefile \
+		|| die "failed to fix the FreeBSD ACTIVEFILE path in the Makefile"
+
+	# Remove the pesky checks about SSL stuff
+	sed -e '/read.*exit/d' -i Makefile \
+		|| die "failed to disable SSL warning in the Makefile"
+
+	sed -e "s:CC=cc:CC=$(tc-getCC):" \
+		-e "s:ARRC=ar:ARRC=$(tc-getAR):" \
+		-e "s:RANLIB=ranlib:RANLIB=$(tc-getRANLIB):" \
+		-i src/osdep/unix/Makefile \
+		|| die "failed to fix build flags support in the Makefile"
+
+	elibtoolize
+}
+
+src_compile() {
+	local mymake ipver ssltype target passwdtype
+	ipver='IP=4'
+	if use ipv6 ; then
+		ipver="IP=6"
+		touch ip6 || die "failed to create ip6 file"
+	fi
+	use ssl && ssltype="unix" || ssltype="none"
+	if use kernel_linux ; then
+		# Fall back to "slx" when USE=pam is not set. This ensures that
+		# we link in libcrypt to get the crypt() routine (bug #456928).
+		use pam && target=lnp passwdtype=pam || target=slx passwdtype=std
+	fi
+	use kerberos \
+		&& mymake="EXTRAAUTHENTICATORS=gss" \
+		&& EXTRALIBS="-lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err" \
+	# no parallel builds supported!
+	emake -j1 SSLTYPE=${ssltype} $target \
+		PASSWDTYPE=${passwdtype} ${ipver} ${mymake} \
+		EXTRACFLAGS="${CFLAGS}" \
+		EXTRALDFLAGS="${LDFLAGS}" \
+		EXTRALIBS="${EXTRALIBS}" \
+		GSSDIR=/usr
+}
+
+src_install() {
+	if use static-libs; then
+		# Library binary
+		dolib.a c-client/c-client.a
+		dosym c-client.a "/usr/$(get_libdir)/libc-client.a"
+	fi
+
+	# Now the shared library
+	dolib.so c-client/libc-client.so.1.0.0
+
+	dosym libc-client.so.1.0.0 "/usr/$(get_libdir)/libc-client.so"
+	dosym libc-client.so.1.0.0 "/usr/$(get_libdir)/libc-client.so.1"
+
+	# Headers
+	insinto /usr/include/imap
+	doins src/osdep/unix/*.h
+	doins src/c-client/*.h
+	doins c-client/linkage.h
+	doins c-client/linkage.c
+	doins c-client/osdep.h
+
+	if use ssl; then
+		echo "  ssl_onceonlyinit ();" >> "${D}"/usr/include/imap/linkage.c \
+			|| die "failed to add ssl init statement to linkage.c"
+	fi
+
+	# Documentation
+	dodoc README docs/*.txt docs/BUILD docs/CONFIG docs/RELNOTES docs/SSLBUILD
+	if use doc; then
+		docinto rfc
+		dodoc docs/rfc/*.txt
+		docinto draft
+		dodoc docs/draft/*
+	fi
+}

diff --git a/net-libs/c-client/files/c-client-2007f-implicit-declaration-fix.patch b/net-libs/c-client/files/c-client-2007f-implicit-declaration-fix.patch
new file mode 100644
index 000000000000..74e223d0f86c
--- /dev/null
+++ b/net-libs/c-client/files/c-client-2007f-implicit-declaration-fix.patch
@@ -0,0 +1,34 @@
+This patch solves build issues with -Werror=implicit-function-declaration
+enabled.
+
+- safe_flock is a function from flocklnx.c but header file for consumers
+  is missing, the simplest was to add function prototype to other
+  header file.
+- utime.h is needed also in multiple places but os_slx.h header file is
+  used in all of them
+
+Bug: https://bugs.gentoo.org/870478
+
+diff --git a/src/osdep/unix/os_slx.h b/src/osdep/unix/os_slx.h
+index b5f39ff..adad223 100644
+--- a/src/osdep/unix/os_slx.h
++++ b/src/osdep/unix/os_slx.h
+@@ -46,6 +46,7 @@
+ #include <sys/types.h>
+ #include <dirent.h>
+ #include <time.h>		/* for struct tm */
++#include <utime.h>
+ #include <fcntl.h>
+ #include <syslog.h>
+ #include <sys/file.h>
+@@ -57,6 +58,7 @@
+ 
+ #define direct dirent
+ 
++int safe_flock(int, int);
+ #define flock safe_flock
+ 
+ 
+-- 
+2.35.1
+

diff --git a/net-libs/c-client/files/c-client-2007f-scandir-callback-types.patch b/net-libs/c-client/files/c-client-2007f-scandir-callback-types.patch
new file mode 100644
index 000000000000..9e067a8ba493
--- /dev/null
+++ b/net-libs/c-client/files/c-client-2007f-scandir-callback-types.patch
@@ -0,0 +1,167 @@
+clang-16 compiler complains with following error message in multiple
+places:
+
+  error: incompatible function pointer types passing 'int (struct dirent *)' to
+        parameter of type 'int (*)(const struct dirent *)' [-Wincompatible-function-pointer-types]
+
+  error: incompatible function pointer types passing
+        'int (const void *, const void *)' to parameter of type 'int (*)(const struct dirent **, const struct dirent **)' [-Wincompatible-function-pointer-types]
+
+This patch fixes all those places by correcting function pointer types
+for scandir callbacks.
+
+Bug: https://bugs.gentoo.org/870478
+
+diff --git a/src/osdep/unix/mh.c b/src/osdep/unix/mh.c
+index 0226b7a..ace2b32 100644
+--- a/src/osdep/unix/mh.c
++++ b/src/osdep/unix/mh.c
+@@ -103,8 +103,8 @@ long mh_copy (MAILSTREAM *stream,char *sequence,char *mailbox,
+ 	      long options);
+ long mh_append (MAILSTREAM *stream,char *mailbox,append_t af,void *data);
+ 
+-int mh_select (struct direct *name);
+-int mh_numsort (const void *d1,const void *d2);
++int mh_select (const struct direct *name);
++int mh_numsort (const struct direct **d1,const struct direct **d2);
+ char *mh_file (char *dst,char *name);
+ long mh_canonicalize (char *pattern,char *ref,char *pat);
+ void mh_setdate (char *file,MESSAGECACHE *elt);
+@@ -1194,7 +1194,7 @@ long mh_append (MAILSTREAM *stream,char *mailbox,append_t af,void *data)
+  * Returns: T to use file name, NIL to skip it
+  */
+ 
+-int mh_select (struct direct *name)
++int mh_select (const struct direct *name)
+ {
+   char c;
+   char *s = name->d_name;
+@@ -1209,7 +1209,7 @@ int mh_select (struct direct *name)
+  * Returns: negative if d1 < d2, 0 if d1 == d2, postive if d1 > d2
+  */
+ 
+-int mh_numsort (const void *d1,const void *d2)
++int mh_numsort (const struct direct **d1,const struct direct **d2)
+ {
+   return atoi ((*(struct direct **) d1)->d_name) -
+     atoi ((*(struct direct **) d2)->d_name);
+diff --git a/src/osdep/unix/mix.c b/src/osdep/unix/mix.c
+index fbf4a02..0964842 100644
+--- a/src/osdep/unix/mix.c
++++ b/src/osdep/unix/mix.c
+@@ -125,7 +125,7 @@ long mix_unsubscribe (MAILSTREAM *stream,char *mailbox);
+ long mix_create (MAILSTREAM *stream,char *mailbox);
+ long mix_delete (MAILSTREAM *stream,char *mailbox);
+ long mix_rename (MAILSTREAM *stream,char *old,char *newname);
+-int mix_rselect (struct direct *name);
++int mix_rselect (const struct direct *name);
+ MAILSTREAM *mix_open (MAILSTREAM *stream);
+ void mix_close (MAILSTREAM *stream,long options);
+ void mix_abort (MAILSTREAM *stream);
+@@ -140,8 +140,8 @@ THREADNODE *mix_thread (MAILSTREAM *stream,char *type,char *charset,
+ long mix_ping (MAILSTREAM *stream);
+ void mix_check (MAILSTREAM *stream);
+ long mix_expunge (MAILSTREAM *stream,char *sequence,long options);
+-int mix_select (struct direct *name);
+-int mix_msgfsort (const void *d1,const void *d2);
++int mix_select (const struct direct *name);
++int mix_msgfsort (const struct direct **d1,const struct direct **d2);
+ long mix_addset (SEARCHSET **set,unsigned long start,unsigned long size);
+ long mix_burp (MAILSTREAM *stream,MIXBURP *burp,unsigned long *reclaimed);
+ long mix_burp_check (SEARCHSET *set,size_t size,char *file);
+@@ -587,7 +587,7 @@ long mix_rename (MAILSTREAM *stream,char *old,char *newname)
+  * Returns: T if mix file name, NIL otherwise
+  */
+ 
+-int mix_rselect (struct direct *name)
++int mix_rselect (const struct direct *name)
+ {
+   return mix_dirfmttest (name->d_name);
+ }
+@@ -1146,7 +1146,7 @@ long mix_expunge (MAILSTREAM *stream,char *sequence,long options)
+  * ".mix" with no suffix was used by experimental versions
+  */
+ 
+-int mix_select (struct direct *name)
++int mix_select (const struct direct *name)
+ {
+   char c,*s;
+ 				/* make sure name has prefix */
+@@ -1165,7 +1165,7 @@ int mix_select (struct direct *name)
+  * Returns: -1 if d1 < d2, 0 if d1 == d2, 1 d1 > d2
+  */
+ 
+-int mix_msgfsort (const void *d1,const void *d2)
++int mix_msgfsort (const struct direct **d1,const struct direct **d2)
+ {
+   char *n1 = (*(struct direct **) d1)->d_name + sizeof (MIXNAME) - 1;
+   char *n2 = (*(struct direct **) d2)->d_name + sizeof (MIXNAME) - 1;
+diff --git a/src/osdep/unix/mx.c b/src/osdep/unix/mx.c
+index 4549527..994f12c 100644
+--- a/src/osdep/unix/mx.c
++++ b/src/osdep/unix/mx.c
+@@ -98,8 +98,8 @@ long mx_append (MAILSTREAM *stream,char *mailbox,append_t af,void *data);
+ long mx_append_msg (MAILSTREAM *stream,char *flags,MESSAGECACHE *elt,
+ 		    STRING *st,SEARCHSET *set);
+ 
+-int mx_select (struct direct *name);
+-int mx_numsort (const void *d1,const void *d2);
++int mx_select (const struct direct *name);
++int mx_numsort (const struct direct **d1,const struct direct **d2);
+ char *mx_file (char *dst,char *name);
+ long mx_lockindex (MAILSTREAM *stream);
+ void mx_unlockindex (MAILSTREAM *stream);
+@@ -1110,7 +1110,7 @@ long mx_append_msg (MAILSTREAM *stream,char *flags,MESSAGECACHE *elt,
+  * Returns: T to use file name, NIL to skip it
+  */
+ 
+-int mx_select (struct direct *name)
++int mx_select (const struct direct *name)
+ {
+   char c;
+   char *s = name->d_name;
+@@ -1125,7 +1125,7 @@ int mx_select (struct direct *name)
+  * Returns: negative if d1 < d2, 0 if d1 == d2, postive if d1 > d2
+  */
+ 
+-int mx_numsort (const void *d1,const void *d2)
++int mx_numsort (const struct direct **d1,const struct direct **d2)
+ {
+   return atoi ((*(struct direct **) d1)->d_name) -
+     atoi ((*(struct direct **) d2)->d_name);
+diff --git a/src/osdep/unix/news.c b/src/osdep/unix/news.c
+index 4cf5bb7..caa6785 100644
+--- a/src/osdep/unix/news.c
++++ b/src/osdep/unix/news.c
+@@ -76,8 +76,8 @@ long news_create (MAILSTREAM *stream,char *mailbox);
+ long news_delete (MAILSTREAM *stream,char *mailbox);
+ long news_rename (MAILSTREAM *stream,char *old,char *newname);
+ MAILSTREAM *news_open (MAILSTREAM *stream);
+-int news_select (struct direct *name);
+-int news_numsort (const void *d1,const void *d2);
++int news_select (const struct direct *name);
++int news_numsort (const struct direct **d1,const struct direct **d2);
+ void news_close (MAILSTREAM *stream,long options);
+ void news_fast (MAILSTREAM *stream,char *sequence,long flags);
+ void news_flags (MAILSTREAM *stream,char *sequence,long flags);
+@@ -402,7 +402,7 @@ MAILSTREAM *news_open (MAILSTREAM *stream)
+  * Returns: T to use file name, NIL to skip it
+  */
+ 
+-int news_select (struct direct *name)
++int news_select (const struct direct *name)
+ {
+   char c;
+   char *s = name->d_name;
+@@ -417,7 +417,7 @@ int news_select (struct direct *name)
+  * Returns: negative if d1 < d2, 0 if d1 == d2, postive if d1 > d2
+  */
+ 
+-int news_numsort (const void *d1,const void *d2)
++int news_numsort (const struct direct **d1,const struct direct **d2)
+ {
+   return atoi ((*(struct direct **) d1)->d_name) -
+     atoi ((*(struct direct **) d2)->d_name);
+-- 
+2.35.1
+


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: net-libs/c-client/files/, net-libs/c-client/
@ 2024-11-27  4:45 Sam James
  0 siblings, 0 replies; 3+ messages in thread
From: Sam James @ 2024-11-27  4:45 UTC (permalink / raw
  To: gentoo-commits

commit:     047bf91f2c9c3bedd713e2d89c4bd67e87f85304
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 27 04:43:54 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Nov 27 04:43:54 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=047bf91f

net-libs/c-client: fix modern C issues

Debian haven't moved on since _p7 in 2019 unfortunately. A friend of mine
has a fork he needs to rebase which I may join him on as a proper base
for distros rather than us all hoarding various patches, but for now,
apply the patch from the bug (which does indeed fix various issues properly
- thanks).

Closes: https://bugs.gentoo.org/919252
Thanks-to: asears <AT> conestogawood.com
Signed-off-by: Sam James <sam <AT> gentoo.org>

 net-libs/c-client/c-client-2007f_p7-r1.ebuild      | 171 +++++
 .../c-client/files/c-client-2007f_p7-c99.patch     | 791 +++++++++++++++++++++
 2 files changed, 962 insertions(+)

diff --git a/net-libs/c-client/c-client-2007f_p7-r1.ebuild b/net-libs/c-client/c-client-2007f_p7-r1.ebuild
new file mode 100644
index 000000000000..fbc76af8b9a9
--- /dev/null
+++ b/net-libs/c-client/c-client-2007f_p7-r1.ebuild
@@ -0,0 +1,171 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit flag-o-matic libtool toolchain-funcs
+
+MY_PN=imap
+MY_P="${MY_PN}-${PV}"
+
+DESCRIPTION="UW IMAP c-client library"
+HOMEPAGE="http://www.washington.edu/imap/"
+SRC_URI="
+	ftp://ftp.cac.washington.edu/imap/${MY_PN}-$(ver_cut 1-2).tar.Z
+	mirror://debian/pool/main/u/uw-${MY_PN}/uw-${MY_PN}_${PV/_p/"~dfsg-"}.debian.tar.xz
+"
+S="${WORKDIR}"/${MY_PN}-$(ver_cut 1-2)
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+IUSE="doc +ipv6 kerberos pam ssl static-libs topal"
+
+RDEPEND="
+	ssl? (
+		dev-libs/openssl:=
+	)
+	kernel_linux? (
+		pam? ( >=sys-libs/pam-0.72 )
+		!pam? ( virtual/libcrypt:= )
+	)
+	kerberos? ( app-crypt/mit-krb5 )
+"
+DEPEND="${RDEPEND}"
+
+PATCHES=(
+	"${WORKDIR}"/debian/patches
+
+	# Apply a patch to only build the stuff we need for c-client
+	"${FILESDIR}/${PN}-2006k_GENTOO_Makefile.patch"
+
+	# Apply patch to add the compilation of a .so for PHP
+	# This was previously conditional, but is more widely useful.
+	"${FILESDIR}/${PN}-2007f_GENTOO_amd64-so-fix.patch"
+
+	# Respect LDFLAGS
+	"${FILESDIR}/${PN}-2007f_p7-ldflags.patch"
+
+	# build fix for -Werror=implicit-function-declaration and
+	# incompatible function pointer types, bug #870478 and bug #919252
+	"${FILESDIR}/${PN}-2007f-scandir-callback-types.patch"
+	"${FILESDIR}/${PN}-2007f_p7-implicit-declaration-fix.patch"
+	"${FILESDIR}/${PN}-2007f_p7-c99.patch"
+)
+
+src_prepare() {
+	use topal && PATCHES+=( "${FILESDIR}/${PN}-2007f-topal.patch" )
+
+	default
+
+	# Tarball packed with bad file perms
+	chmod -R u+rwX,go-w . || die "failed to fix permissions"
+
+	# Lots of things need -fPIC, including various platforms, and this library
+	# generally should be built with it anyway.
+	append-flags -fPIC
+
+	# Modifications so we can build it optimally and correctly
+	sed \
+		-e "s:BASECFLAGS=\".*\":BASECFLAGS=:g" \
+		-e 's:SSLDIR=/usr/local/ssl:SSLDIR=/usr:g' \
+		-e 's:SSLCERTS=$(SSLDIR)/certs:SSLCERTS=/etc/ssl/certs:g' \
+		-i src/osdep/unix/Makefile \
+		|| die "failed to fix compiler flags and SSL paths in the Makefile"
+
+	# Make the build system more multilib aware
+	sed \
+		-e "s:^SSLLIB=\$(SSLDIR)/lib:SSLLIB=\$(SSLDIR)/$(get_libdir):" \
+		-e "s:^AFSLIB=\$(AFSDIR)/lib:AFSLIB=\$(AFSDIR)/$(get_libdir):" \
+		-i src/osdep/unix/Makefile \
+		|| die "failed to fix our libdir in the Makefile"
+
+	# Targets should use the Gentoo (ie linux) fs
+	sed -e '/^bsf:/,/^$/ s:ACTIVEFILE=.*:ACTIVEFILE=/var/lib/news/active:g' \
+		-i src/osdep/unix/Makefile \
+		|| die "failed to fix the FreeBSD ACTIVEFILE path in the Makefile"
+
+	# Remove the pesky checks about SSL stuff
+	sed -e '/read.*exit/d' -i Makefile \
+		|| die "failed to disable SSL warning in the Makefile"
+
+	sed -e "s:CC=cc:CC=$(tc-getCC):" \
+		-e "s:ARRC=ar:ARRC=$(tc-getAR):" \
+		-e "s:RANLIB=ranlib:RANLIB=$(tc-getRANLIB):" \
+		-i src/osdep/unix/Makefile \
+		|| die "failed to fix build flags support in the Makefile"
+
+	sed -i -e "s:krb5-config.mit:krb5-config:" src/osdep/unix/Makefile.gss || die
+
+	elibtoolize
+}
+
+src_compile() {
+	local mymake target passwdtype
+
+	local ipver='IP=4'
+	if use ipv6 ; then
+		ipver="IP=6"
+		touch ip6 || die "failed to create ip6 file"
+	fi
+
+	local ssltype="none"
+	if use ssl ; then
+		ssltype="unix"
+	fi
+
+	if use kernel_linux ; then
+		# Fall back to "slx" when USE=pam is not set. This ensures that
+		# we link in libcrypt to get the crypt() routine (bug #456928).
+		use pam && target=lnps passwdtype=pam || target=slx passwdtype=std
+	fi
+
+	if use kerberos ; then
+		mymake="EXTRAAUTHENTICATORS=gss"
+		EXTRALIBS="-lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err"
+	fi
+
+	emake -j1 \
+		SSLTYPE=${ssltype} ${target} \
+		PASSWDTYPE=${passwdtype} ${ipver} ${mymake} \
+		EXTRACFLAGS="${CFLAGS}" \
+		EXTRALDFLAGS="${LDFLAGS}" \
+		EXTRALIBS="${EXTRALIBS}" \
+		GSSDIR=/usr
+}
+
+src_install() {
+	if use static-libs; then
+		# Library binary
+		dolib.a c-client/c-client.a
+		dosym c-client.a "/usr/$(get_libdir)/libc-client.a"
+	fi
+
+	# Now the shared library
+	dolib.so c-client/libc-client.so.1.0.0
+
+	dosym libc-client.so.1.0.0 "/usr/$(get_libdir)/libc-client.so"
+	dosym libc-client.so.1.0.0 "/usr/$(get_libdir)/libc-client.so.1"
+
+	# Headers
+	insinto /usr/include/imap
+	doins src/osdep/unix/*.h
+	doins src/c-client/*.h
+	doins c-client/linkage.h
+	doins c-client/linkage.c
+	doins c-client/osdep.h
+
+	if use ssl; then
+		echo "  ssl_onceonlyinit ();" >> "${D}"/usr/include/imap/linkage.c \
+			|| die "failed to add ssl init statement to linkage.c"
+	fi
+
+	# Documentation
+	dodoc README docs/*.txt docs/BUILD docs/CONFIG docs/RELNOTES docs/SSLBUILD
+	if use doc; then
+		docinto rfc
+		dodoc docs/rfc/*.txt
+		docinto draft
+		dodoc docs/draft/*
+	fi
+}

diff --git a/net-libs/c-client/files/c-client-2007f_p7-c99.patch b/net-libs/c-client/files/c-client-2007f_p7-c99.patch
new file mode 100644
index 000000000000..4ee62e7d6d1a
--- /dev/null
+++ b/net-libs/c-client/files/c-client-2007f_p7-c99.patch
@@ -0,0 +1,791 @@
+https://bugs.gentoo.org/919252#c9
+--- a/src/osdep/unix/mbx.c
++++ b/src/osdep/unix/mbx.c
+@@ -209,7 +209,7 @@
+   off_t pos;
+   char c,*s,*t,hdr[HDRSIZE];
+   struct stat sbuf;
+-  time_t tp[2];
++  struct utimbuf tp;
+   int error = EINVAL;		/* assume invalid argument */
+   if (ld) *ld = -1;		/* initially no lock */
+   if ((s = mbx_file (tmp,name)) && !stat (s,&sbuf) &&
+@@ -298,9 +298,9 @@
+     else lseek (fd,0,L_SET);	/* else rewind to start */
+ 				/* \Marked status? */
+     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 */
++      tp.actime = sbuf.st_atime;	/* preserve atime and mtime */
++      tp.modtime = sbuf.st_mtime;
++      utime (tmp,&tp);		/* set the times */
+     }
+   }
+ 				/* in case INBOX but not mbx format */
+@@ -759,22 +759,22 @@
+ 
+ void mbx_flag (MAILSTREAM *stream,char *sequence,char *flag,long flags)
+ {
+-  time_t tp[2];
++  struct utimbuf tp;
+   struct stat sbuf;
+   unsigned long oldpid = LOCAL->lastpid;
+ 				/* make sure the update takes */
+   if (!stream->rdonly && LOCAL && (LOCAL->fd >= 0) && (LOCAL->ld >= 0)) {
+     fsync (LOCAL->fd);
+     fstat (LOCAL->fd,&sbuf);	/* get current write time */
+-    tp[1] = LOCAL->filetime = sbuf.st_mtime;
++    tp.modtime = LOCAL->filetime = sbuf.st_mtime;
+ 				/* we are the last flag updater */
+     LOCAL->lastpid = (unsigned long) getpid ();
+ 				/* update header if needed */
+     if (((LOCAL->ffuserflag < NUSERFLAGS) &&
+ 	 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);
++    tp.actime = time (0);		/* make sure read comes after all that */
++    utime (stream->mailbox,&tp);
+   }
+   if (LOCAL->ld >= 0) {		/* unlock now */
+     unlockfd (LOCAL->ld,LOCAL->lock);
+@@ -984,7 +984,7 @@
+ long mbx_copy (MAILSTREAM *stream,char *sequence,char *mailbox,long options)
+ {
+   struct stat sbuf;
+-  time_t tp[2];
++  struct utimbuf tp;
+   MESSAGECACHE *elt;
+   unsigned long i,j,k,m;
+   long ret = LONGT;
+@@ -1069,11 +1069,11 @@
+     mail_free_searchset (&source);
+     mail_free_searchset (&dest);
+   }
+-  if (ret) tp[0] = time (0) - 1;/* set atime to now-1 if successful copy */
++  if (ret) tp.actime = time (0) - 1;/* set atime to now-1 if successful copy */
+ 				/* 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 */
++  else tp.actime = (sbuf.st_ctime > sbuf.st_atime) ? sbuf.st_atime : time(0);
++  tp.modtime = sbuf.st_mtime;	/* preserve mtime */
++  utime (file,&tp);		/* set the times */
+   close (fd);			/* close the file */
+   MM_NOCRITICAL (stream);	/* release critical */
+   unlockfd (ld,lock);		/* release exclusive parse/append permission */
+@@ -1105,7 +1105,7 @@
+   struct stat sbuf;
+   int fd,ld;
+   char *flags,*date,tmp[MAILTMPLEN],file[MAILTMPLEN],lock[MAILTMPLEN];
+-  time_t tp[2];
++  struct utimbuf tp;
+   FILE *df;
+   MESSAGECACHE elt;
+   long f;
+@@ -1207,11 +1207,11 @@
+     }
+     else mail_free_searchset (&dst);
+ 				/* set atime to now-1 if successful copy */
+-    if (ret) tp[0] = time (0) - 1;
++    if (ret) tp.actime = time (0) - 1;
+ 				/* 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 */
++    else tp.actime = (sbuf.st_ctime > sbuf.st_atime) ? sbuf.st_atime : time(0);
++    tp.modtime = sbuf.st_mtime;	/* preserve mtime */
++    utime (file,&tp);		/* set the times */
+     fclose (df);		/* close the file */
+     MM_NOCRITICAL (dstream);	/* release critical */
+   }
+@@ -1441,10 +1441,10 @@
+   fstat (LOCAL->fd,&sbuf);	/* get status again to ensure time is right */
+   LOCAL->filetime = sbuf.st_mtime;
+   if (added && !stream->rdonly){/* make sure atime updated */
+-    time_t tp[2];
+-    tp[0] = time (0);
+-    tp[1] = LOCAL->filetime;
+-    utime (stream->mailbox,tp);
++    struct utimbuf tp;
++    tp.actime = time (0);
++    tp.modtime = LOCAL->filetime;
++    utime (stream->mailbox,&tp);
+   }
+   stream->silent = silent;	/* can pass up events now */
+   mail_exists (stream,nmsgs);	/* notify upper level of new mailbox size */
+@@ -1691,7 +1691,7 @@
+ unsigned long mbx_rewrite (MAILSTREAM *stream,unsigned long *reclaimed,
+ 			   long flags)
+ {
+-  time_t tp[2];
++  struct utimbuf tp;
+   struct stat sbuf;
+   off_t pos,ppos;
+   int ld;
+@@ -1810,9 +1810,9 @@
+     fsync (LOCAL->fd);		/* force disk update */
+   }
+   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);
++  tp.modtime = LOCAL->filetime = sbuf.st_mtime;
++  tp.actime = time (0);		/* reset atime to now */
++  utime (stream->mailbox,&tp);
+   unlockfd (ld,lock);		/* release exclusive parse/append permission */
+ 				/* notify upper level of new mailbox size */
+   mail_exists (stream,stream->nmsgs);
+--- a/src/osdep/unix/mh.c
++++ b/src/osdep/unix/mh.c
+@@ -1276,8 +1276,8 @@
+ 
+ void mh_setdate (char *file,MESSAGECACHE *elt)
+ {
+-  time_t tp[2];
+-  tp[0] = time (0);		/* atime is now */
+-  tp[1] = mail_longdate (elt);	/* modification time */
+-  utime (file,tp);		/* set the times */
++  struct utimbuf tp;
++  tp.actime = time (0);		/* atime is now */
++  tp.modtime = mail_longdate (elt);	/* modification time */
++  utime (file,&tp);		/* set the times */
+ }
+--- a/src/osdep/unix/mmdf.c
++++ b/src/osdep/unix/mmdf.c
+@@ -366,7 +366,7 @@
+   int ret = NIL;
+   char *t,file[MAILTMPLEN];
+   struct stat sbuf;
+-  time_t tp[2];
++  struct utimbuf tp;
+   errno = EINVAL;		/* assume invalid argument */
+ 				/* must be non-empty file */
+   if ((t = dummy_file (file,name)) && !stat (t,&sbuf)) {
+@@ -377,9 +377,9 @@
+       close (fd);		/* close the file */
+ 				/* \Marked status? */
+       if ((sbuf.st_ctime > sbuf.st_atime) || (sbuf.st_mtime > sbuf.st_atime)) {
+-	tp[0] = sbuf.st_atime;	/* preserve atime and mtime */
+-	tp[1] = sbuf.st_mtime;
+-	utime (file,tp);	/* set the times */
++	tp.actime = sbuf.st_atime;	/* preserve atime and mtime */
++	tp.modtime = sbuf.st_mtime;
++	utime (file,&tp);	/* set the times */
+       }
+     }
+   }
+@@ -1024,7 +1024,7 @@
+   int fd;
+   char *s,file[MAILTMPLEN];
+   DOTLOCK lock;
+-  time_t tp[2];
++  struct utimbuf tp;
+   unsigned long i,j;
+   MESSAGECACHE *elt;
+   long ret = T;
+@@ -1126,12 +1126,12 @@
+     mail_free_searchset (&source);
+     mail_free_searchset (&dest);
+   }
+-  tp[1] = time (0);		/* set mtime to now */
+-  if (ret) tp[0] = tp[1] - 1;	/* set atime to now-1 if successful copy */
+-  else tp[0] =			/* else preserve \Marked status */
++  tp.modtime = time (0);		/* set mtime to now */
++  if (ret) tp.actime = tp.modtime - 1;	/* set atime to now-1 if successful copy */
++  else tp.actime =			/* else preserve \Marked status */
+ 	 ((sbuf.st_ctime > sbuf.st_atime) || (sbuf.st_mtime > sbuf.st_atime)) ?
+-	 sbuf.st_atime : tp[1];
+-  utime (file,tp);		/* set the times */
++	 sbuf.st_atime : tp.modtime;
++  utime (file,&tp);		/* set the times */
+   mmdf_unlock (fd,NIL,&lock);	/* unlock and close mailbox */
+   if (tstream) {		/* update last UID if we can */
+     MMDFLOCAL *local = (MMDFLOCAL *) tstream->local;
+@@ -1165,7 +1165,7 @@
+   int fd;
+   unsigned long i;
+   char *flags,*date,buf[BUFLEN],tmp[MAILTMPLEN],file[MAILTMPLEN];
+-  time_t tp[2];
++  struct utimbuf tp;
+   FILE *sf,*df;
+   MESSAGECACHE elt;
+   DOTLOCK lock;
+@@ -1279,20 +1279,20 @@
+   }
+   fstat (fd,&sbuf);		/* get current file size */
+   rewind (sf);
+-  tp[1] = time (0);		/* set mtime to now */
++  tp.modtime = time (0);		/* set mtime to now */
+ 				/* write all messages */
+   if (!mmdf_append_msgs (tstream,sf,df,au ? dst : NIL) ||
+       (fflush (df) == EOF) || fsync (fd)) {
+     sprintf (buf,"Message append failed: %s",strerror (errno));
+     MM_LOG (buf,ERROR);
+     ftruncate (fd,sbuf.st_size);
+-    tp[0] =			/* preserve \Marked status */
++    tp.actime =			/* preserve \Marked status */
+       ((sbuf.st_ctime > sbuf.st_atime) || (sbuf.st_mtime > sbuf.st_atime)) ?
+-      sbuf.st_atime : tp[1];
++      sbuf.st_atime : tp.modtime;
+     ret = NIL;			/* return error */
+   }
+-  else tp[0] = tp[1] - 1;	/* set atime to now-1 if successful copy */
+-  utime (file,tp);		/* set the times */
++  else tp.actime = tp.modtime - 1;	/* set atime to now-1 if successful copy */
++  utime (file,&tp);		/* set the times */
+   fclose (sf);			/* done with scratch file */
+ 				/* force UIDVALIDITY assignment now */
+   if (tstream && !tstream->uid_validity) tstream->uid_validity = time (0);
+@@ -1526,31 +1526,31 @@
+ {
+   if (stream) {			/* need to muck with times? */
+     struct stat sbuf;
+-    time_t tp[2];
++    struct utimbuf tp;
+     time_t now = time (0);
+     fstat (fd,&sbuf);		/* get file times */
+     if (LOCAL->ld >= 0) {	/* yes, readwrite session? */
+-      tp[0] = now;		/* set atime to now */
++      tp.actime = now;		/* set atime to now */
+ 				/* set mtime to (now - 1) if necessary */
+-      tp[1] = (now > sbuf.st_mtime) ? sbuf.st_mtime : now - 1;
++      tp.modtime = (now > sbuf.st_mtime) ? sbuf.st_mtime : now - 1;
+     }
+     else if (stream->recent) {	/* readonly with recent messages */
+       if ((sbuf.st_atime >= sbuf.st_mtime) ||
+ 	  (sbuf.st_atime >= sbuf.st_ctime))
+ 				/* keep past mtime, whack back atime */
+-	tp[0] = (tp[1] = (sbuf.st_mtime < now) ? sbuf.st_mtime : now) - 1;
++	tp.actime = (tp.modtime = (sbuf.st_mtime < now) ? sbuf.st_mtime : now) - 1;
+       else now = 0;		/* no time change needed */
+     }
+ 				/* readonly with no recent messages */
+     else if ((sbuf.st_atime < sbuf.st_mtime) ||
+ 	     (sbuf.st_atime < sbuf.st_ctime)) {
+-      tp[0] = now;		/* set atime to now */
++      tp.actime = now;		/* set atime to now */
+ 				/* set mtime to (now - 1) if necessary */
+-      tp[1] = (now > sbuf.st_mtime) ? sbuf.st_mtime : now - 1;
++      tp.modtime = (now > sbuf.st_mtime) ? sbuf.st_mtime : now - 1;
+     }
+     else now = 0;		/* no time change needed */
+ 				/* set the times, note change */
+-    if (now && !utime (stream->mailbox,tp)) LOCAL->filetime = tp[1];
++    if (now && !utime (stream->mailbox,&tp)) LOCAL->filetime = tp.modtime;
+   }
+   flock (fd,LOCK_UN);		/* release flock'ers */
+   if (!stream) close (fd);	/* close the file if no stream */
+@@ -2238,7 +2238,7 @@
+   MESSAGECACHE *elt;
+   MMDFFILE f;
+   char *s;
+-  time_t tp[2];
++  struct utimbuf tp;
+   long ret,flag;
+   unsigned long i,j;
+   unsigned long recent = stream->recent;
+@@ -2391,9 +2391,9 @@
+     mail_exists (stream,stream->nmsgs);
+     mail_recent (stream,recent);
+ 				/* set atime to now, mtime a second earlier */
+-    tp[1] = (tp[0] = time (0)) - 1;
++    tp.modtime = (tp.actime = time (0)) - 1;
+ 				/* set the times, note change */
+-    if (!utime (stream->mailbox,tp)) LOCAL->filetime = tp[1];
++    if (!utime (stream->mailbox,&tp)) LOCAL->filetime = tp.modtime;
+     close (LOCAL->fd);		/* close and reopen file */
+     if ((LOCAL->fd = open (stream->mailbox,O_RDWR,
+ 			   (long) mail_parameters (NIL,GET_MBXPROTECTION,NIL)))
+--- a/src/osdep/unix/mtx.c
++++ b/src/osdep/unix/mtx.c
+@@ -172,7 +172,7 @@
+   int ret = NIL;
+   char *s,file[MAILTMPLEN];
+   struct stat sbuf;
+-  time_t tp[2];
++  struct utimbuf tp;
+   errno = EINVAL;		/* assume invalid argument */
+ 				/* if file, get its status */
+   if ((s = mtx_file (file,name)) && !stat (s,&sbuf)) {
+@@ -194,9 +194,9 @@
+       close (fd);		/* close the file */
+ 				/* \Marked status? */
+       if (sbuf.st_ctime > sbuf.st_atime) {
+-	tp[0] = sbuf.st_atime;	/* preserve atime and mtime */
+-	tp[1] = sbuf.st_mtime;
+-	utime (file,tp);	/* set the times */
++	tp.actime = sbuf.st_atime;	/* preserve atime and mtime */
++	tp.modtime = sbuf.st_mtime;
++	utime (file,&tp);	/* set the times */
+       }
+     }
+   }
+@@ -558,14 +558,14 @@
+ 
+ void mtx_flag (MAILSTREAM *stream,char *sequence,char *flag,long flags)
+ {
+-  time_t tp[2];
++  struct utimbuf tp;
+   struct stat sbuf;
+   if (!stream->rdonly) {	/* make sure the update takes */
+     fsync (LOCAL->fd);
+     fstat (LOCAL->fd,&sbuf);	/* get current write time */
+-    tp[1] = LOCAL->filetime = sbuf.st_mtime;
+-    tp[0] = time (0);		/* make sure read comes after all that */
+-    utime (stream->mailbox,tp);
++    tp.modtime = LOCAL->filetime = sbuf.st_mtime;
++    tp.actime = time (0);		/* make sure read comes after all that */
++    utime (stream->mailbox,&tp);
+   }
+ }
+ 
+@@ -729,7 +729,7 @@
+ long mtx_expunge (MAILSTREAM *stream,char *sequence,long options)
+ {
+   long ret;
+-  time_t tp[2];
++  struct utimbuf tp;
+   struct stat sbuf;
+   off_t pos = 0;
+   int ld;
+@@ -832,9 +832,9 @@
+       else MM_LOG ("No messages deleted, so no update needed",(long) NIL);
+       fsync (LOCAL->fd);	/* force disk update */
+       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);
++      tp.modtime = LOCAL->filetime = sbuf.st_mtime;
++      tp.actime = time (0);		/* reset atime to now */
++      utime (stream->mailbox,&tp);
+       MM_NOCRITICAL (stream);	/* release critical */
+ 				/* notify upper level of new mailbox size */
+       mail_exists (stream,stream->nmsgs);
+@@ -859,7 +859,7 @@
+ long mtx_copy (MAILSTREAM *stream,char *sequence,char *mailbox,long options)
+ {
+   struct stat sbuf;
+-  time_t tp[2];
++  struct utimbuf tp;
+   MESSAGECACHE *elt;
+   unsigned long i,j,k;
+   long ret = LONGT;
+@@ -925,11 +925,11 @@
+     MM_LOG (LOCAL->buf,ERROR);
+     ftruncate (fd,sbuf.st_size);
+   }
+-  if (ret) tp[0] = time (0) - 1;/* set atime to now-1 if successful copy */
++  if (ret) tp.actime = time (0) - 1;/* set atime to now-1 if successful copy */
+ 				/* 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 */
++  else tp.actime = (sbuf.st_ctime > sbuf.st_atime) ? sbuf.st_atime : time(0);
++  tp.modtime = sbuf.st_mtime;	/* preserve mtime */
++  utime (file,&tp);		/* set the times */
+   close (fd);			/* close the file */
+   unlockfd (ld,lock);		/* release exclusive parse/append permission */
+   MM_NOCRITICAL (stream);	/* release critical */
+@@ -944,9 +944,9 @@
+     if (!stream->rdonly) {	/* make sure the update takes */
+       fsync (LOCAL->fd);
+       fstat (LOCAL->fd,&sbuf);	/* get current write time */
+-      tp[1] = LOCAL->filetime = sbuf.st_mtime;
+-      tp[0] = time (0);		/* make sure atime remains greater */
+-      utime (stream->mailbox,tp);
++      tp.modtime = LOCAL->filetime = sbuf.st_mtime;
++      tp.actime = time (0);		/* make sure atime remains greater */
++      utime (stream->mailbox,&tp);
+     }
+   }
+   if (ret && mail_parameters (NIL,GET_COPYUID,NIL))
+@@ -967,7 +967,7 @@
+   struct stat sbuf;
+   int fd,ld,c;
+   char *flags,*date,tmp[MAILTMPLEN],file[MAILTMPLEN],lock[MAILTMPLEN];
+-  time_t tp[2];
++  struct utimbuf tp;
+   FILE *df;
+   MESSAGECACHE elt;
+   long f;
+@@ -1058,11 +1058,11 @@
+     }
+     ret = NIL;
+   }
+-  if (ret) tp[0] = time (0) - 1;/* set atime to now-1 if successful copy */
++  if (ret) tp.actime = time (0) - 1;/* set atime to now-1 if successful copy */
+ 				/* 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 */
++  else tp.actime = (sbuf.st_ctime > sbuf.st_atime) ? sbuf.st_atime : time(0);
++  tp.modtime = sbuf.st_mtime;	/* preserve mtime */
++  utime (file,&tp);		/* set the times */
+   fclose (df);			/* close the file */
+   unlockfd (ld,lock);		/* release exclusive parse/append permission */
+   MM_NOCRITICAL (stream);	/* release critical */
+@@ -1209,10 +1209,10 @@
+   fstat (LOCAL->fd,&sbuf);	/* get status again to ensure time is right */
+   LOCAL->filetime = sbuf.st_mtime;
+   if (added && !stream->rdonly){/* make sure atime updated */
+-    time_t tp[2];
+-    tp[0] = time (0);
+-    tp[1] = LOCAL->filetime;
+-    utime (stream->mailbox,tp);
++    struct utimbuf tp;
++    tp.actime = time (0);
++    tp.modtime = LOCAL->filetime;
++    utime (stream->mailbox,&tp);
+   }
+   stream->silent = silent;	/* can pass up events now */
+   mail_exists (stream,nmsgs);	/* notify upper level of new mailbox size */
+@@ -1287,7 +1287,7 @@
+ 
+ void mtx_update_status (MAILSTREAM *stream,unsigned long msgno,long syncflag)
+ {
+-  time_t tp[2];
++  struct utimbuf tp;
+   struct stat sbuf;
+   MESSAGECACHE *elt = mail_elt (stream,msgno);
+   unsigned long j,k = 0;
+@@ -1310,9 +1310,9 @@
+     if (syncflag) {		/* sync if requested */
+       fsync (LOCAL->fd);
+       fstat (LOCAL->fd,&sbuf);	/* get new write time */
+-      tp[1] = LOCAL->filetime = sbuf.st_mtime;
+-      tp[0] = time (0);		/* make sure read is later */
+-      utime (stream->mailbox,tp);
++      tp.modtime = LOCAL->filetime = sbuf.st_mtime;
++      tp.actime = time (0);		/* make sure read is later */
++      utime (stream->mailbox,&tp);
+     }
+   }
+ }
+--- a/src/osdep/unix/mx.c
++++ b/src/osdep/unix/mx.c
+@@ -1280,8 +1280,8 @@
+ 
+ void mx_setdate (char *file,MESSAGECACHE *elt)
+ {
+-  time_t tp[2];
+-  tp[0] = time (0);		/* atime is now */
+-  tp[1] = mail_longdate (elt);	/* modification time */
+-  utime (file,tp);		/* set the times */
++  struct utimbuf tp;
++  tp.actime = time (0);		/* atime is now */
++  tp.modtime = mail_longdate (elt);	/* modification time */
++  utime (file,&tp);		/* set the times */
+ }
+--- a/src/osdep/unix/tenex.c
++++ b/src/osdep/unix/tenex.c
+@@ -179,7 +179,7 @@
+   int ret = NIL;
+   char *s,file[MAILTMPLEN];
+   struct stat sbuf;
+-  time_t tp[2];
++  struct utimbuf tp;
+   errno = EINVAL;		/* assume invalid argument */
+ 				/* if file, get its status */
+   if ((s = tenex_file (file,name)) && !stat (s,&sbuf)) {
+@@ -201,9 +201,9 @@
+       close (fd);		/* close the file */
+ 				/* \Marked status? */
+       if (sbuf.st_ctime > sbuf.st_atime) {
+-	tp[0] = sbuf.st_atime;	/* preserve atime and mtime */
+-	tp[1] = sbuf.st_mtime;
+-	utime (file,tp);	/* set the times */
++	tp.actime = sbuf.st_atime;	/* preserve atime and mtime */
++	tp.modtime = sbuf.st_mtime;
++	utime (file,&tp);	/* set the times */
+       }
+     }
+   }
+@@ -647,14 +647,14 @@
+ 
+ void tenex_flag (MAILSTREAM *stream,char *sequence,char *flag,long flags)
+ {
+-  time_t tp[2];
++  struct utimbuf tp;
+   struct stat sbuf;
+   if (!stream->rdonly) {	/* make sure the update takes */
+     fsync (LOCAL->fd);
+     fstat (LOCAL->fd,&sbuf);	/* get current write time */
+-    tp[1] = LOCAL->filetime = sbuf.st_mtime;
+-    tp[0] = time (0);		/* make sure read comes after all that */
+-    utime (stream->mailbox,tp);
++    tp.modtime = LOCAL->filetime = sbuf.st_mtime;
++    tp.actime = time (0);		/* make sure read comes after all that */
++    utime (stream->mailbox,&tp);
+   }
+ }
+ 
+@@ -818,7 +818,7 @@
+ long tenex_expunge (MAILSTREAM *stream,char *sequence,long options)
+ {
+   long ret;
+-  time_t tp[2];
++  struct utimbuf tp;
+   struct stat sbuf;
+   off_t pos = 0;
+   int ld;
+@@ -922,9 +922,9 @@
+       else MM_LOG ("No messages deleted, so no update needed",(long) NIL);
+       fsync (LOCAL->fd);		/* force disk update */
+       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);
++      tp.modtime = LOCAL->filetime = sbuf.st_mtime;
++      tp.actime = time (0);		/* reset atime to now */
++      utime (stream->mailbox,&tp);
+       MM_NOCRITICAL (stream);	/* release critical */
+ 				/* notify upper level of new mailbox size */
+       mail_exists (stream,stream->nmsgs);
+@@ -949,7 +949,7 @@
+ long tenex_copy (MAILSTREAM *stream,char *sequence,char *mailbox,long options)
+ {
+   struct stat sbuf;
+-  time_t tp[2];
++  struct utimbuf tp;
+   MESSAGECACHE *elt;
+   unsigned long i,j,k;
+   long ret = LONGT;
+@@ -1015,11 +1015,11 @@
+     MM_LOG (LOCAL->buf,ERROR);
+     ftruncate (fd,sbuf.st_size);
+   }
+-  if (ret) tp[0] = time (0) - 1;/* set atime to now-1 if successful copy */
++  if (ret) tp.actime = time (0) - 1;/* set atime to now-1 if successful copy */
+ 				/* 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 */
++  else tp.actime = (sbuf.st_ctime > sbuf.st_atime) ? sbuf.st_atime : time(0);
++  tp.modtime = sbuf.st_mtime;	/* preserve mtime */
++  utime (file,&tp);		/* set the times */
+   close (fd);			/* close the file */
+   unlockfd (ld,lock);		/* release exclusive parse/append permission */
+   MM_NOCRITICAL (stream);	/* release critical */
+@@ -1034,9 +1034,9 @@
+     if (!stream->rdonly) {	/* make sure the update takes */
+       fsync (LOCAL->fd);
+       fstat (LOCAL->fd,&sbuf);	/* get current write time */
+-      tp[1] = LOCAL->filetime = sbuf.st_mtime;
+-      tp[0] = time (0);		/* make sure atime remains greater */
+-      utime (stream->mailbox,tp);
++      tp.modtime = LOCAL->filetime = sbuf.st_mtime;
++      tp.actime = time (0);		/* make sure atime remains greater */
++      utime (stream->mailbox,&tp);
+     }
+   }
+   if (ret && mail_parameters (NIL,GET_COPYUID,NIL))
+@@ -1057,7 +1057,7 @@
+   struct stat sbuf;
+   int fd,ld,c;
+   char *flags,*date,tmp[MAILTMPLEN],file[MAILTMPLEN],lock[MAILTMPLEN];
+-  time_t tp[2];
++  struct utimbuf tp;
+   FILE *df;
+   MESSAGECACHE elt;
+   long f;
+@@ -1155,11 +1155,11 @@
+     }
+     ret = NIL;
+   }
+-  if (ret) tp[0] = time (0) - 1;/* set atime to now-1 if successful copy */
++  if (ret) tp.actime = time (0) - 1;/* set atime to now-1 if successful copy */
+ 				/* 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 */
++  else tp.actime = (sbuf.st_ctime > sbuf.st_atime) ? sbuf.st_atime : time(0);
++  tp.modtime = sbuf.st_mtime;	/* preserve mtime */
++  utime (file,&tp);		/* set the times */
+   fclose (df);			/* close the file */
+   unlockfd (ld,lock);		/* release exclusive parse/append permission */
+   MM_NOCRITICAL (stream);	/* release critical */
+@@ -1321,10 +1321,10 @@
+   fstat (LOCAL->fd,&sbuf);	/* get status again to ensure time is right */
+   LOCAL->filetime = sbuf.st_mtime;
+   if (added && !stream->rdonly){/* make sure atime updated */
+-    time_t tp[2];
+-    tp[0] = time (0);
+-    tp[1] = LOCAL->filetime;
+-    utime (stream->mailbox,tp);
++    struct utimbuf tp;
++    tp.actime = time (0);
++    tp.modtime = LOCAL->filetime;
++    utime (stream->mailbox,&tp);
+   }
+   stream->silent = silent;	/* can pass up events now */
+   mail_exists (stream,nmsgs);	/* notify upper level of new mailbox size */
+@@ -1399,7 +1399,7 @@
+ 
+ void tenex_update_status (MAILSTREAM *stream,unsigned long msgno,long syncflag)
+ {
+-  time_t tp[2];
++  struct utimbuf tp;
+   struct stat sbuf;
+   MESSAGECACHE *elt = mail_elt (stream,msgno);
+   unsigned long j,k = 0;
+@@ -1422,9 +1422,9 @@
+     if (syncflag) {		/* sync if requested */
+       fsync (LOCAL->fd);
+       fstat (LOCAL->fd,&sbuf);	/* get new write time */
+-      tp[1] = LOCAL->filetime = sbuf.st_mtime;
+-      tp[0] = time (0);		/* make sure read is later */
+-      utime (stream->mailbox,tp);
++      tp.modtime = LOCAL->filetime = sbuf.st_mtime;
++      tp.actime = time (0);		/* make sure read is later */
++      utime (stream->mailbox,&tp);
+     }
+   }
+ }
+--- a/src/osdep/unix/unix.c
++++ b/src/osdep/unix/unix.c
+@@ -214,7 +214,7 @@
+   DRIVER *ret = NIL;
+   char *t,file[MAILTMPLEN];
+   struct stat sbuf;
+-  time_t tp[2];
++  struct utimbuf tp;
+   errno = EINVAL;		/* assume invalid argument */
+ 				/* must be non-empty file */
+   if ((t = dummy_file (file,name)) && !stat (t,&sbuf)) {
+@@ -226,9 +226,9 @@
+       close (fd);		/* close the file */
+ 				/* \Marked status? */
+       if ((sbuf.st_ctime > sbuf.st_atime) || (sbuf.st_mtime > sbuf.st_atime)) {
+-	tp[0] = sbuf.st_atime;	/* yes, preserve atime and mtime */
+-	tp[1] = sbuf.st_mtime;
+-	utime (file,tp);	/* set the times */
++	tp.actime = sbuf.st_atime;	/* yes, preserve atime and mtime */
++	tp.modtime = sbuf.st_mtime;
++	utime (file,&tp);	/* set the times */
+       }
+     }
+   }
+@@ -884,7 +884,7 @@
+   int fd;
+   char *s,file[MAILTMPLEN];
+   DOTLOCK lock;
+-  time_t tp[2];
++  struct utimbuf tp;
+   unsigned long i,j;
+   MESSAGECACHE *elt;
+   long ret = T;
+@@ -990,12 +990,12 @@
+     mail_free_searchset (&source);
+     mail_free_searchset (&dest);
+   }
+-  tp[1] = time (0);		/* set mtime to now */
+-  if (ret) tp[0] = tp[1] - 1;	/* set atime to now-1 if successful copy */
+-  else tp[0] =			/* else preserve \Marked status */
++  tp.modtime = time (0);		/* set mtime to now */
++  if (ret) tp.actime = tp.modtime - 1;	/* set atime to now-1 if successful copy */
++  else tp.actime =			/* else preserve \Marked status */
+ 	 ((sbuf.st_ctime > sbuf.st_atime) || (sbuf.st_mtime > sbuf.st_atime)) ?
+-	 sbuf.st_atime : tp[1];
+-  utime (file,tp);		/* set the times */
++	 sbuf.st_atime : tp.modtime;
++  utime (file,&tp);		/* set the times */
+   unix_unlock (fd,NIL,&lock);	/* unlock and close mailbox */
+   if (tstream) {		/* update last UID if we can */
+     UNIXLOCAL *local = (UNIXLOCAL *) tstream->local;
+@@ -1029,7 +1029,7 @@
+   int fd;
+   unsigned long i;
+   char *flags,*date,buf[BUFLEN],tmp[MAILTMPLEN],file[MAILTMPLEN];
+-  time_t tp[2];
++  struct utimbuf tp;
+   FILE *sf,*df;
+   MESSAGECACHE elt;
+   DOTLOCK lock;
+@@ -1143,20 +1143,20 @@
+   }
+   fstat (fd,&sbuf);		/* get current file size */
+   rewind (sf);
+-  tp[1] = time (0);		/* set mtime to now */
++  tp.modtime = time (0);		/* set mtime to now */
+ 				/* write all messages */
+   if (!unix_append_msgs (tstream,sf,df,au ? dst : NIL) ||
+       (fflush (df) == EOF) || fsync (fd)) {
+     sprintf (buf,"Message append failed: %s",strerror (errno));
+     MM_LOG (buf,ERROR);
+     ftruncate (fd,sbuf.st_size);
+-    tp[0] =			/* preserve \Marked status */
++    tp.actime =			/* preserve \Marked status */
+       ((sbuf.st_ctime > sbuf.st_atime) || (sbuf.st_mtime > sbuf.st_atime)) ?
+-      sbuf.st_atime : tp[1];
++      sbuf.st_atime : tp.modtime;
+     ret = NIL;			/* return error */
+   }
+-  else tp[0] = tp[1] - 1;	/* set atime to now-1 if successful copy */
+-  utime (file,tp);		/* set the times */
++  else tp.actime = tp.modtime - 1;	/* set atime to now-1 if successful copy */
++  utime (file,&tp);		/* set the times */
+   fclose (sf);			/* done with scratch file */
+ 				/* force UIDVALIDITY assignment now */
+   if (tstream && !tstream->uid_validity) tstream->uid_validity = time (0);
+@@ -1397,31 +1397,31 @@
+ {
+   if (stream) {			/* need to muck with times? */
+     struct stat sbuf;
+-    time_t tp[2];
++    struct utimbuf tp;
+     time_t now = time (0);
+     fstat (fd,&sbuf);		/* get file times */
+     if (LOCAL->ld >= 0) {	/* yes, readwrite session? */
+-      tp[0] = now;		/* set atime to now */
++      tp.actime = now;		/* set atime to now */
+ 				/* set mtime to (now - 1) if necessary */
+-      tp[1] = (now > sbuf.st_mtime) ? sbuf.st_mtime : now - 1;
++      tp.modtime = (now > sbuf.st_mtime) ? sbuf.st_mtime : now - 1;
+     }
+     else if (stream->recent) {	/* readonly with recent messages */
+       if ((sbuf.st_atime >= sbuf.st_mtime) ||
+ 	  (sbuf.st_atime >= sbuf.st_ctime))
+ 				/* keep past mtime, whack back atime */
+-	tp[0] = (tp[1] = (sbuf.st_mtime < now) ? sbuf.st_mtime : now) - 1;
++	tp.actime = (tp.modtime = (sbuf.st_mtime < now) ? sbuf.st_mtime : now) - 1;
+       else now = 0;		/* no time change needed */
+     }
+ 				/* readonly with no recent messages */
+     else if ((sbuf.st_atime < sbuf.st_mtime) ||
+ 	     (sbuf.st_atime < sbuf.st_ctime)) {
+-      tp[0] = now;		/* set atime to now */
++      tp.actime = now;		/* set atime to now */
+ 				/* set mtime to (now - 1) if necessary */
+-      tp[1] = (now > sbuf.st_mtime) ? sbuf.st_mtime : now - 1;
++      tp.modtime = (now > sbuf.st_mtime) ? sbuf.st_mtime : now - 1;
+     }
+     else now = 0;		/* no time change needed */
+ 				/* set the times, note change */
+-    if (now && !utime (stream->mailbox,tp)) LOCAL->filetime = tp[1];
++    if (now && !utime (stream->mailbox,&tp)) LOCAL->filetime = tp.modtime;
+   }
+   flock (fd,LOCK_UN);		/* release flock'ers */
+   if (!stream) close (fd);	/* close the file if no stream */
+@@ -2075,7 +2075,7 @@
+   MESSAGECACHE *elt;
+   UNIXFILE f;
+   char *s;
+-  time_t tp[2];
++  struct utimbuf tp;
+   long ret,flag;
+   unsigned long i,j;
+   unsigned long recent = stream->recent;
+@@ -2245,9 +2245,9 @@
+     mail_exists (stream,stream->nmsgs);
+     mail_recent (stream,recent);
+ 				/* set atime to now, mtime a second earlier */
+-    tp[1] = (tp[0] = time (0)) - 1;
++    tp.modtime = (tp.actime = time (0)) - 1;
+ 				/* set the times, note change */
+-    if (!utime (stream->mailbox,tp)) LOCAL->filetime = tp[1];
++    if (!utime (stream->mailbox,&tp)) LOCAL->filetime = tp.modtime;
+     close (LOCAL->fd);		/* close and reopen file */
+     if ((LOCAL->fd = open (stream->mailbox,O_RDWR,
+ 			   (long) mail_parameters (NIL,GET_MBXPROTECTION,NIL)))


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-11-27  4:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-07 11:28 [gentoo-commits] repo/gentoo:master commit in: net-libs/c-client/files/, net-libs/c-client/ Sam James
  -- strict thread matches above, loose matches on Subject: below --
2024-11-27  4:45 Sam James
2016-10-09 16:19 Pacho Ramos

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox