aboutsummaryrefslogtreecommitdiffstats
path: root/lib/fuse_loop_mt.c
diff options
context:
space:
mode:
authorJoanne Koong <joannelkoong@gmail.com>2024-10-07 13:37:20 -0700
committerBernd Schubert <bernd.schubert@fastmail.fm>2024-10-11 13:15:38 +0200
commit535808c4d93e4637577aa17bf8413a41920dd2d8 (patch)
tree823ce1f443beeb98ec5a1ae997375b8d70161014 /lib/fuse_loop_mt.c
parent55eb214db9fa6c16f0af6a4e1a70b56b959aee3e (diff)
downloadlibfuse-535808c4d93e4637577aa17bf8413a41920dd2d8.tar.gz
Add libfuse util strtol wrapper
Add a wrapper around strtol for more rigorous error checking and convert uses of atoi and strtol to use this instead.
Diffstat (limited to 'lib/fuse_loop_mt.c')
-rw-r--r--lib/fuse_loop_mt.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/fuse_loop_mt.c b/lib/fuse_loop_mt.c
index ecf8af8..075ac2e 100644
--- a/lib/fuse_loop_mt.c
+++ b/lib/fuse_loop_mt.c
@@ -13,6 +13,7 @@
#include "fuse_misc.h"
#include "fuse_kernel.h"
#include "fuse_i.h"
+#include "util.h"
#include <stdio.h>
#include <stdlib.h>
@@ -220,8 +221,17 @@ int fuse_start_thread(pthread_t *thread_id, void *(*func)(void *), void *arg)
*/
pthread_attr_init(&attr);
stack_size = getenv(ENVNAME_THREAD_STACK);
- if (stack_size && pthread_attr_setstacksize(&attr, atoi(stack_size)))
- fuse_log(FUSE_LOG_ERR, "fuse: invalid stack size: %s\n", stack_size);
+ if (stack_size) {
+ long size;
+
+ res = libfuse_strtol(stack_size, &size);
+ if (res)
+ fuse_log(FUSE_LOG_ERR, "fuse: invalid stack size: %s\n",
+ stack_size);
+ else if (pthread_attr_setstacksize(&attr, size))
+ fuse_log(FUSE_LOG_ERR, "fuse: could not set stack size: %ld\n",
+ size);
+ }
/* Disallow signal reception in worker threads */
sigemptyset(&newset);