git-svn: trunk@2887
Nigel Horne authored on 2007/03/02 01:51:47... | ... |
@@ -92,6 +92,8 @@ static char const rcsid[] = "$Id: mbox.c,v 1.381 2007/02/15 12:26:44 njh Exp $"; |
92 | 92 |
|
93 | 93 |
static void sigsegv(int sig); |
94 | 94 |
static void print_trace(int use_syslog); |
95 |
+ |
|
96 |
+/*#define SAVE_TMP /* Save the file being worked on in tmp */ |
|
95 | 97 |
#endif |
96 | 98 |
|
97 | 99 |
#if defined(NO_STRTOK_R) || !defined(CL_THREAD_SAFE) |
... | ... |
@@ -1244,7 +1246,7 @@ cli_parse_mbox(const char *dir, int desc, cli_ctx *ctx) |
1244 | 1244 |
void (*segv)(int); |
1245 | 1245 |
#endif |
1246 | 1246 |
static table_t *rfc821, *subtype; |
1247 |
-#ifdef CL_DEBUG |
|
1247 |
+#ifdef SAVE_TMP |
|
1248 | 1248 |
char tmpfilename[16]; |
1249 | 1249 |
int tmpfd; |
1250 | 1250 |
#endif |
... | ... |
@@ -1289,7 +1291,7 @@ cli_parse_mbox(const char *dir, int desc, cli_ctx *ctx) |
1289 | 1289 |
return CL_EOPEN; |
1290 | 1290 |
} |
1291 | 1291 |
rewind(fd); /* bug 240 */ |
1292 |
-#ifdef CL_DEBUG |
|
1292 |
+#ifdef SAVE_TMP |
|
1293 | 1293 |
/* |
1294 | 1294 |
* Copy the incoming mail for debugging, so that if it falls over |
1295 | 1295 |
* we have a copy of the offending email. This is debugging code |
... | ... |
@@ -1317,7 +1319,7 @@ cli_parse_mbox(const char *dir, int desc, cli_ctx *ctx) |
1317 | 1317 |
if(fgets(buffer, sizeof(buffer) - 1, fd) == NULL) { |
1318 | 1318 |
/* empty message */ |
1319 | 1319 |
fclose(fd); |
1320 |
-#ifdef CL_DEBUG |
|
1320 |
+#ifdef SAVE_TMP |
|
1321 | 1321 |
unlink(tmpfilename); |
1322 | 1322 |
#endif |
1323 | 1323 |
return CL_CLEAN; |
... | ... |
@@ -1335,7 +1337,7 @@ cli_parse_mbox(const char *dir, int desc, cli_ctx *ctx) |
1335 | 1335 |
pthread_mutex_unlock(&tables_mutex); |
1336 | 1336 |
#endif |
1337 | 1337 |
fclose(fd); |
1338 |
-#ifdef CL_DEBUG |
|
1338 |
+#ifdef SAVE_TMP |
|
1339 | 1339 |
unlink(tmpfilename); |
1340 | 1340 |
#endif |
1341 | 1341 |
return CL_EMEM; |
... | ... |
@@ -1396,7 +1398,7 @@ cli_parse_mbox(const char *dir, int desc, cli_ctx *ctx) |
1396 | 1396 |
#ifdef HAVE_BACKTRACE |
1397 | 1397 |
signal(SIGSEGV, segv); |
1398 | 1398 |
#endif |
1399 |
-#ifdef CL_DEBUG |
|
1399 |
+#ifdef SAVE_TMP |
|
1400 | 1400 |
unlink(tmpfilename); |
1401 | 1401 |
#endif |
1402 | 1402 |
return CL_EMEM; |
... | ... |
@@ -1538,7 +1540,7 @@ cli_parse_mbox(const char *dir, int desc, cli_ctx *ctx) |
1538 | 1538 |
signal(SIGSEGV, segv); |
1539 | 1539 |
#endif |
1540 | 1540 |
|
1541 |
-#ifdef CL_DEBUG |
|
1541 |
+#ifdef SAVE_TMP |
|
1542 | 1542 |
unlink(tmpfilename); |
1543 | 1543 |
#endif |
1544 | 1544 |
return retcode; |
... | ... |
@@ -3121,7 +3123,7 @@ boundaryStart(const char *line, const char *boundary) |
3121 | 3121 |
if(ptr == NULL) |
3122 | 3122 |
ptr = line; |
3123 | 3123 |
|
3124 |
- if(*ptr++ != '-') { |
|
3124 |
+ if((*ptr++ != '-') || (*ptr == '\0')) { |
|
3125 | 3125 |
if(out) |
3126 | 3126 |
free(out); |
3127 | 3127 |
return 0; |