changeset 2872:c0e2a38b7647 HEAD

Check for libgen.h and if it's not found, use my_basename(). Also my_seteuid() didn't actually replace seteuid() before if it didn't exist.
author Timo Sirainen <tss@iki.fi>
date Mon, 08 Nov 2004 04:45:59 +0200
parents d72a03773b2f
children 72f28a4b964d
files configure.in src/lib/compat.c src/lib/compat.h
diffstat 3 files changed, 20 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/configure.in	Mon Nov 08 04:31:40 2004 +0200
+++ b/configure.in	Mon Nov 08 04:45:59 2004 +0200
@@ -1,4 +1,4 @@
-AC_INIT(dovecot, 1.0-test50, [dovecot@dovecot.org])
+AC_INIT(dovecot, 1.0-test52, [dovecot@dovecot.org])
 AC_CONFIG_SRCDIR([src])
 
 AC_CONFIG_HEADERS([config.h])
@@ -15,7 +15,7 @@
 AM_ICONV
 
 AC_CHECK_HEADERS(strings.h stdint.h unistd.h dirent.h \
-  sys/uio.h sys/sysmacros.h sys/resource.h sys/select.h)
+  sys/uio.h sys/sysmacros.h sys/resource.h sys/select.h libgen.h)
 
 # check posix headers
 AC_CHECK_HEADERS(sys/time.h)
--- a/src/lib/compat.c	Mon Nov 08 04:31:40 2004 +0200
+++ b/src/lib/compat.c	Mon Nov 08 04:45:59 2004 +0200
@@ -172,3 +172,15 @@
 #endif
 }
 #endif
+
+#ifndef HAVE_LIBGEN_H
+char *my_basename(char *path)
+{
+	char *p;
+
+	/* note that this isn't POSIX-compliant basename() replacement.
+	   too much trouble without any gain. */
+	p = strrchr(path, '/');
+	return p == NULL ? path : p + 1;
+}
+#endif
--- a/src/lib/compat.h	Mon Nov 08 04:31:40 2004 +0200
+++ b/src/lib/compat.h	Mon Nov 08 04:45:59 2004 +0200
@@ -109,9 +109,15 @@
 #endif
 
 #ifndef HAVE_SETEUID
+#  define seteuid my_seteuid
 int my_seteuid(uid_t euid);
 #endif
 
+#ifndef HAVE_LIBGEN_H
+#  define basename my_basename
+char *my_basename(char *path);
+#endif
+
 /* ctype.h isn't safe with signed chars,
    use our own instead if really needed */
 #define i_toupper(x) ((char) toupper((int) (unsigned char) (x)))