[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
abort() in regex.c
From: |
Vladimir 'φ-coder/phcoder' Serbinenko |
Subject: |
abort() in regex.c |
Date: |
Mon, 26 Mar 2012 03:30:15 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20120216 Icedove/8.0 |
Hello, all. In GRUB everything runs in the same environment and so
abort() can only be mapped to complete bootloader termination. It's
unreasonable to do such an action in case of regexp error. Can we do
something like following:
=== modified file 'grub-core/gnulib/regcomp.c'
--- grub-core/gnulib/regcomp.c 2012-03-26 00:45:46 +0000
+++ grub-core/gnulib/regcomp.c 2012-03-26 01:27:04 +0000
@@ -549,13 +549,19 @@ regerror (int errcode, const regex_t *_R
if (BE (errcode < 0
|| errcode >= (int) (sizeof (__re_error_msgid_idx)
/ sizeof (__re_error_msgid_idx[0])), 0))
- /* Only error codes returned by the rest of the code should be passed
- to this routine. If we are given anything else, or if other regex
- code generates an invalid error code, then the program has a bug.
- Dump core so we can fix it. */
- abort ();
-
- msg = gettext (__re_error_msgid + __re_error_msgid_idx[errcode]);
+ {
+#ifdef HAVE_ABORT
+ /* Only error codes returned by the rest of the code should be passed
+ to this routine. If we are given anything else, or if other regex
+ code generates an invalid error code, then the program has a bug.
+ Dump core so we can fix it. */
+ abort ();
+#else
+ msg = gettext ("unknown regexp error");
+#endif
+ }
+ else
+ msg = gettext (__re_error_msgid + __re_error_msgid_idx[errcode]);
msg_size = strlen (msg) + 1; /* Includes the null. */
@@ -1151,7 +1157,10 @@ optimize_utf8 (re_dfa_t *dfa)
}
break;
default:
+#ifdef HAVE_ABORT
abort ();
+#endif
+ break;
}
if (mb_chars || has_period)
--
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
signature.asc
Description: OpenPGP digital signature
- abort() in regex.c,
Vladimir 'φ-coder/phcoder' Serbinenko <=