[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] pagealign_alloc: don't loop endlessly
From: |
Derek Price |
Subject: |
Re: [PATCH] pagealign_alloc: don't loop endlessly |
Date: |
Wed, 04 May 2005 10:23:09 -0400 |
User-agent: |
Mozilla Thunderbird 1.0.2 (Windows/20050317) |
Does the attached, more general, patch do the trick for you?
I think the problem is deeper - error() really needs a way to bypass the
memory allocation of the buffer routines, but this should work around
the problem for now.
Cheers,
Derek
Thorsten Glaser wrote:
>Hello!
>
>Please apply the following patch. It prevents GNU CVS 1.12.12
>from looping endlessly and dumping core due to lack of stack
>(recursion depth) when /dev/zero cannot be found, for example
>in a chroot(2) environment.
>
>I have copyright assignments for CVS filed with the FSF.
>
>//mirabile
>
>
Index: src/error.c
===================================================================
RCS file: /cvs/ccvs/src/error.c,v
retrieving revision 1.42
diff -u -p -r1.42 error.c
--- src/error.c 18 Mar 2005 16:41:24 -0000 1.42
+++ src/error.c 4 May 2005 14:14:29 -0000
@@ -119,6 +119,10 @@ error (int status, int errnum, const cha
char statcmdbuf[32];
char *cmdbuf;
char *emptybuf = "";
+ static bool in_error = false;
+
+ if (in_error) goto recursion_error;
+ in_error = true;
/* Initialize these to avoid a lot of special case error handling. */
buf = statbuf;
@@ -173,6 +177,9 @@ error (int status, int errnum, const cha
/* Restore errno per our charter. */
errno = save_errno;
+ /* Reset our recursion lock. */
+ in_error = false;
+
/* Done. */
return;
@@ -195,6 +202,21 @@ memerror:
#endif /* HAVE_SYSLOG_H */
exit (EXIT_FAILURE);
+
+recursion_error:
+#if HAVE_SYSLOG_H
+ syslog (LOG_DAEMON | LOG_EMERG,
+ "error (%d, %d) called recursively. Message was:",
+ status, errnum);
+
+ va_start (args, message);
+ vsyslog (LOG_DAEMON | LOG_EMERG, message, args);
+ va_end (args);
+
+ syslog (LOG_DAEMON | LOG_EMERG, "Aborting.");
+#endif /* HAVE_SYSLOG_H */
+
+ exit (EXIT_FAILURE);
}
signature.asc
Description: OpenPGP digital signature
- Re: [PATCH] pagealign_alloc: don't loop endlessly,
Derek Price <=
Re: [PATCH] pagealign_alloc: don't loop endlessly, Derek Price, 2005/05/04