aboutsummaryrefslogtreecommitdiffstats
path: root/lib/mount_bsd.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/mount_bsd.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/mount_bsd.c')
-rw-r--r--lib/mount_bsd.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/lib/mount_bsd.c b/lib/mount_bsd.c
index c9669ae..1863c49 100644
--- a/lib/mount_bsd.c
+++ b/lib/mount_bsd.c
@@ -155,22 +155,17 @@ static int fuse_mount_core(const char *mountpoint, const char *opts)
char *fdnam, *dev;
pid_t pid, cpid;
int status;
+ int err;
fdnam = getenv("FUSE_DEV_FD");
if (fdnam) {
- char *ep;
-
- fd = strtol(fdnam, &ep, 10);
-
- if (*ep != '\0') {
+ err = libfuse_strtol(fdnam, &fd);
+ if (err) {
fuse_log(FUSE_LOG_ERR, "invalid value given in FUSE_DEV_FD\n");
return -1;
}
- if (fd < 0)
- return -1;
-
goto mount;
}