[dovecot-cvs] dovecot/src/lib compat.c, 1.19, 1.20 compat.h, 1.25, 1.26

cras at dovecot.org cras at dovecot.org
Mon Nov 8 04:46:01 EET 2004


Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv21495/src/lib

Modified Files:
	compat.c compat.h 
Log Message:
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.



Index: compat.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/compat.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- compat.c	8 Oct 2004 13:33:03 -0000	1.19
+++ compat.c	8 Nov 2004 02:45:59 -0000	1.20
@@ -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

Index: compat.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/compat.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- compat.h	8 Oct 2004 13:33:03 -0000	1.25
+++ compat.h	8 Nov 2004 02:45:59 -0000	1.26
@@ -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)))



More information about the dovecot-cvs mailing list