30 Commits

Author SHA1 Message Date
psycho c99f6182b4 libfuse升级
Signed-off-by: psycho <wangmingxuan6@h-partners.com>
2024-01-09 09:19:42 +08:00
a1346054 8166eeffa5 remove executable file mode bit from source files 2021-08-25 14:46:25 +02:00
lixiaokeng 4d2860a9f5 Fix: a potential crash on failure to setlocale
setlocale() can fail, returning NULL, which will lead
to a crash in iconv_new(). Fix it like in iconv_help().

Signed-off-by: Lixiaokeng <lixiaokeng@huawei.com>
2021-06-16 18:25:14 +01:00
Jérémie Galarneau 87fbb7c379 Fix: crash on failure to set locale (#529)
setlocale() can fail, returning NULL, if the user has an invalid (or
missing) locale set in the LANG environment variable.

In my case, this happens when using VS Code's integrated terminal to
launch a fuse-based filesystem. A bug (fix upcoming) results in VS Code
setting an invalid locale.

iconv_help() currently passes the return value of setlocale(...)
directly to strdup() without checking if it is NULL, resulting in a
crash.

To reproduce, simply set LANG="something_invalid" and call
fuse_lib_help().

Stack trace when the process receives `SIGSEGV`:

(gdb) bt
 #0  0x00007fabd0fcc4b5 in __strlen_avx2 () from /usr/lib/libc.so.6
 #1  0x00007fabd0ef9233 in strdup () from /usr/lib/libc.so.6
 #2  0x00007fabd13b8128 in iconv_help () at ../lib/modules/iconv.c:641
 #3  0x00007fabd13b81a8 in iconv_opt_proc (data=0x55580a6ee850, arg=0x55580a6edfb0 "-h", key=0, outargs=0x7ffeeb1a8ec8) at ../lib/modules/iconv.c:658
 #4  0x00007fabd13af7d5 in call_proc (ctx=0x7ffeeb1a8ea0, arg=0x55580a6edfb0 "-h", key=0, iso=0) at ../lib/fuse_opt.c:161
 #5  0x00007fabd13afaf1 in process_opt (ctx=0x7ffeeb1a8ea0, opt=0x7fabd13c3d40 <iconv_opts>, sep=0, arg=0x55580a6edfb0 "-h", iso=0) at ../lib/fuse_opt.c:233
 #6  0x00007fabd13afd5a in process_gopt (ctx=0x7ffeeb1a8ea0, arg=0x55580a6edfb0 "-h", iso=0) at ../lib/fuse_opt.c:285
 #7  0x00007fabd13b0117 in process_one (ctx=0x7ffeeb1a8ea0, arg=0x55580a6edfb0 "-h") at ../lib/fuse_opt.c:368
 #8  0x00007fabd13b0190 in opt_parse (ctx=0x7ffeeb1a8ea0) at ../lib/fuse_opt.c:379
 #9  0x00007fabd13b03d3 in fuse_opt_parse (args=0x7ffeeb1a8f70, data=0x55580a6ee850, opts=0x7fabd13c3d40 <iconv_opts>, proc=0x7fabd13b8186 <iconv_opt_proc>)
    at ../lib/fuse_opt.c:414
 #10 0x00007fabd13b8226 in iconv_new (args=0x7ffeeb1a8f70, next=0x0) at ../lib/modules/iconv.c:680
 #11 0x00007fabd13a5627 in print_module_help (name=0x7fabd13b9e1c "iconv", fac=0x7fabd13d48e0 <fuse_module_iconv_factory>) at ../lib/fuse.c:4692
 #12 0x00007fabd13a56aa in fuse_lib_help (args=0x7ffeeb1a9238) at ../lib/fuse.c:4721

iconv_help() is modified to print an error when setlocale() fails.
It then carries on printing the iconv module's help.

Reading setlocale(3), it seems that the strdup() of the result was
not necessary.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@gmail.com>
2020-07-10 19:59:57 +01:00
Albert Chen 28ebae29ba Fixed minor print alignment issue in iconv_help(), replacing tab with space (#519) 2020-07-03 12:39:09 +01:00
winndows 4579bd35fa libfuse: Assign NULL to "old" to avoid free it twice (#522)
Assign NULL to "old" at the first free(), to avoid the possible 2nd free() for it.

Signed-off-by: Liao Pingfang <liao.pingfang@zte.com.cn>
Co-authored-by: Liao Pingfang <liao.pingfang@zte.com.cn>
2020-07-01 06:20:01 +01:00
Yuri Per 93b44b4db3 Implement lseek operation (#457) 2019-11-03 09:44:31 +00:00
Stefan Hajnoczi 56345a98c5 Introduce callback for logging
Introduce an API for custom log handler functions.  This allows libfuse
applications to send messages to syslog(3) or other logging systems.
See include/fuse_log.h for details.

Convert libfuse from fprintf(stderr, ...) to log_fuse(level, ...).  Most
messages are error messages with FUSE_LOG_ERR log level.  There are also
some debug messages which now use the FUSE_LOG_DEBUG log level.

Note that lib/mount_util.c is used by both libfuse and fusermount3.
Since fusermount3 does not link against libfuse, we cannot call
fuse_log() from lib/mount_util.c.  This file will continue to use
fprintf(stderr, ...) until someone figures out how to split it up.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2019-09-04 15:59:18 +01:00
Nikolaus Rath c64e00aa4d Don't redefine FUSE_USE_VERSION
It's already set in meson.build as compiler flag.
2017-07-06 18:30:13 +02:00
Nikolaus Rath 1d9f26f373 Turn fuse_operations.nopath_flag into fuse_config.nullpath_ok
Modifying struct fuse_config in the init() handler is the canonical way
to adjust file-system implementation specific settings. There is no need
to have flags in struct fuse_operations.
2016-10-20 15:45:32 -07:00
Nikolaus Rath 6c66dac9f2 Pass struct fuse_config to high-level init() handler. 2016-10-20 14:05:15 -07:00
Nikolaus Rath 73b6ff4b75 Pass fuse_file_info to getattr, chown, chmod, truncate, utimens handlers
This obsoletes the ftruncate & fgetattr handlers.

Fixes #58.
2016-10-15 18:46:27 -07:00
Miklos Szeredi b49cf754f9 libfuse: add flags to ->rename()
See renameat2() system call in linux-3.15 and later kernels.
2014-07-15 18:02:19 +02:00
Eric Wong 6bf2e6f07c libfuse: implement readdirplus for high-level API
Reuse the old "readdir" callback, but add a flags argument, that has
FUSE_READDIR_PLUS in case this is a "plus" version.  Filesystems can safely
ignore this flag, but if they want they can add optimizations based on it:
i.e. only retrieve the full attributes in PLUS mode.

The filler function is also given a flags argument and the filesystem can
set FUSE_FILL_DIR_PLUS if all the attributes in "stat" are valid.
2014-03-05 14:45:44 +01:00
Miklos Szeredi 9ffe64abe1 Print help on stdout instead of stderr 2013-07-26 16:20:28 +02:00
Miklos Szeredi e6e7a249c5 libfuse: remove "-D_FILE_OFFSET_BITS=64" from fuse.pc
add AC_SYS_LARGEFILE to your configure.ac instead.
2013-07-24 17:09:26 +02:00
Miklos Szeredi 78c2cc25d5 Remove compatibility path handling
This means that now NULL is a valid path for operations that take a file
descriptor if the file was unlinked and hard_remove option is specified.
2012-07-20 09:45:09 +02:00
Miklos Szeredi 2b4b5cc544 Start of 3.0 series
Change the version numbers.

This is going to be a new major version of the library breaking backward
compatibility on the binary level as well as the source level.
2012-07-19 18:40:11 +02:00
Miklos Szeredi 3b5acfac06 libfuse: mark some data constant 2012-07-04 12:19:29 +02:00
Miklos Szeredi 8edeaa3f29 Add ->flock() operation to low and high level interfaces
This fixes problems with emulating flock() with POSIX locking.
Reported by Sebastian Pipping.

As with lock/setlk/getlk most filesystems don't need to implement
this, as the kernel takes care of file locking.  The only reason to
implement locking operations is for network filesystems which want
file locking to work between clients.
2011-07-06 12:12:01 +02:00
Laszlo Papp 3a48e06de9 Fix a possible resource leak (free the old up) 2011-03-30 19:34:58 +02:00
Miklos Szeredi 6332203885 add read_buf method to high level API
Add a new read_buf() method to the highlevel API.  This allows
returning a generic buffer from the read method, which in turn allows
zero copy reads.
2010-11-10 11:41:21 +01:00
Miklos Szeredi df31f2b11e add write_buf method to high level API
Add new write_buf() method to the highlevel API.  Similarly to the
lowlevel write_buf() method, this allows implementing zero copy
writes.
2010-11-10 11:41:21 +01:00
Miklos Szeredi ca14187b22 * Add a nopath option and flag, indicating that path argument
need not be calculated for the following operations: read, write,
flush, release, fsync, readdir, releasedir, fsyncdir, ftruncate,
fgetattr, lock, ioctl and poll.
2010-06-15 17:55:37 +00:00
Miklos Szeredi 30ece08000 Support receiving file handle from kernel in GETATTR request; Allow operations with a NULL path argument, if the filesystem supports it 2008-02-08 17:22:15 +00:00
Miklos Szeredi cdb8b79bad change indenting 2007-12-12 14:25:40 +00:00
Miklos Szeredi 7d62647d7a Clarify licence version to be "LGPLv2" for the library 2007-10-16 15:12:09 +00:00
Miklos Szeredi 6353dcaf4e update flush changes 2007-05-11 09:19:36 +00:00
Miklos Szeredi 79b6209843 doc 2007-04-28 17:38:17 +00:00
Miklos Szeredi 3a7c00ec0c Add filesystem stacking support to high level API 2007-02-03 23:32:47 +00:00