aboutsummaryrefslogtreecommitdiff
path: root/src/common/util.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-07-15 12:26:55 -0400
committerNick Mathewson <nickm@torproject.org>2013-07-15 12:26:55 -0400
commit22977b7c1dd6b693237fb3fed1cd6f88ec71cb21 (patch)
tree1e0432725155ce4f4e11823d0265cecc79a03226 /src/common/util.c
parent449b2b7c58e5dd5b33941a5142524a66c64c98ec (diff)
downloadtor-22977b7c1dd6b693237fb3fed1cd6f88ec71cb21.tar
tor-22977b7c1dd6b693237fb3fed1cd6f88ec71cb21.tar.gz
Expose format_hex_number_..., and rename it to ..._sigsafe().
There are some other places in the code that will want a signal-safe way to format numbers, so it shouldn't be static to util.c.
Diffstat (limited to 'src/common/util.c')
-rw-r--r--src/common/util.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/common/util.c b/src/common/util.c
index 95dea4b69..a5e41bf25 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -3402,9 +3402,8 @@ tor_join_win_cmdline(const char *argv[])
* function; it's designed to be used in code paths where you can't call
* arbitrary C functions.
*/
-STATIC int
-format_hex_number_for_helper_exit_status(unsigned int x, char *buf,
- int max_len)
+int
+format_hex_number_sigsafe(unsigned int x, char *buf, int max_len)
{
int len;
unsigned int tmp;
@@ -3490,8 +3489,8 @@ format_helper_exit_status(unsigned char child_state, int saved_errno,
cur = hex_errno;
/* Emit child_state */
- written = format_hex_number_for_helper_exit_status(child_state,
- cur, left);
+ written = format_hex_number_sigsafe(child_state, cur, left);
+
if (written <= 0)
goto err;
@@ -3520,8 +3519,7 @@ format_helper_exit_status(unsigned char child_state, int saved_errno,
}
/* Emit unsigned_errno */
- written = format_hex_number_for_helper_exit_status(unsigned_errno,
- cur, left);
+ written = format_hex_number_sigsafe(unsigned_errno, cur, left);
if (written <= 0)
goto err;