Browse code

update NAME_MAX block and add workaround for HP-UX

git-svn: trunk@2879

Tomasz Kojm authored on 2007/03/01 09:40:34
Showing 4 changed files
... ...
@@ -1,3 +1,8 @@
1
+Wed Feb 28 23:40:04 CET 2007 (tk)
2
+---------------------------------
3
+  * libclamav/others.h: update NAME_MAX block and add workaround for HP-UX
4
+			(bb#367)
5
+
1 6
 Wed Feb 28 21:55:22 CET 2007 (tk)
2 7
 ---------------------------------
3 8
   * libclamav/unrar/unrar.c: fix leak in cli_unrar_extract_next_prepare (bb#352)
... ...
@@ -72,19 +72,6 @@ static pthread_mutex_t cli_gentempname_mutex = PTHREAD_MUTEX_INITIALIZER;
72 72
 #include "md5.h"
73 73
 #include "cltypes.h"
74 74
 
75
-/* Maximum filenames under various systems - njh */
76
-#ifndef	NAME_MAX	/* e.g. Linux */
77
-# ifdef	MAXNAMELEN	/* e.g. Solaris */
78
-#   define	NAME_MAX	MAXNAMELEN
79
-# else
80
-#   ifdef	FILENAME_MAX	/* e.g. SCO */
81
-#     define	NAME_MAX	FILENAME_MAX
82
-#   else
83
-#     define	NAME_MAX	256
84
-#   endif
85
-# endif
86
-#endif
87
-
88 75
 #ifndef	O_BINARY
89 76
 #define	O_BINARY	0
90 77
 #endif
... ...
@@ -53,10 +53,17 @@
53 53
 # else
54 54
 #   ifdef	FILENAME_MAX	/* e.g. SCO */
55 55
 #     define	NAME_MAX	FILENAME_MAX
56
+#   else
57
+#     define    NAME_MAX        256
56 58
 #   endif
57 59
 # endif
58 60
 #endif
59 61
 
62
+#if NAME_MAX < 256
63
+#undef NAME_MAX
64
+#define NAME_MAX 256
65
+#endif
66
+
60 67
 /* internal clamav context */
61 68
 typedef struct {
62 69
     const char **virname;
... ...
@@ -101,19 +101,6 @@ extern short cli_leavetemps_flag;
101 101
 #include <stddef.h>
102 102
 #endif
103 103
 
104
-/* Maximum filenames under various systems - njh */
105
-#ifndef	NAME_MAX	/* e.g. Linux */
106
-# ifdef	MAXNAMELEN	/* e.g. Solaris */
107
-#   define	NAME_MAX	MAXNAMELEN
108
-# else
109
-#   ifdef	FILENAME_MAX	/* e.g. SCO */
110
-#     define	NAME_MAX	FILENAME_MAX
111
-#   else
112
-#     define	NAME_MAX	256
113
-#   endif
114
-# endif
115
-#endif
116
-
117 104
 #define MAX_MAIL_RECURSION  15
118 105
 
119 106
 static int cli_scanfile(const char *filename, cli_ctx *ctx);