mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-27 04:32:16 +03:00
Enable -Wwrite-strings
Also, fix leak from ztest_global_vars_to_zdb_args() Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #13348
This commit is contained in:
@@ -74,7 +74,7 @@ build_iovec(struct iovec **iov, int *iovlen, const char *name, void *val,
|
||||
}
|
||||
|
||||
static int
|
||||
do_mount_(const char *spec, const char *dir, int mflag, char *fstype,
|
||||
do_mount_(const char *spec, const char *dir, int mflag,
|
||||
char *dataptr, int datalen, char *optptr, int optlen)
|
||||
{
|
||||
struct iovec *iov;
|
||||
@@ -83,8 +83,6 @@ do_mount_(const char *spec, const char *dir, int mflag, char *fstype,
|
||||
|
||||
assert(spec != NULL);
|
||||
assert(dir != NULL);
|
||||
assert(fstype != NULL);
|
||||
assert(strcmp(fstype, MNTTYPE_ZFS) == 0);
|
||||
assert(dataptr == NULL), (void) dataptr;
|
||||
assert(datalen == 0), (void) datalen;
|
||||
assert(optptr != NULL);
|
||||
@@ -99,7 +97,8 @@ do_mount_(const char *spec, const char *dir, int mflag, char *fstype,
|
||||
build_iovec(&iov, &iovlen, "update", NULL, 0);
|
||||
if (mflag & MS_RDONLY)
|
||||
build_iovec(&iov, &iovlen, "ro", NULL, 0);
|
||||
build_iovec(&iov, &iovlen, "fstype", fstype, (size_t)-1);
|
||||
build_iovec(&iov, &iovlen, "fstype", __DECONST(char *, MNTTYPE_ZFS),
|
||||
(size_t)-1);
|
||||
build_iovec(&iov, &iovlen, "fspath", __DECONST(char *, dir),
|
||||
(size_t)-1);
|
||||
build_iovec(&iov, &iovlen, "from", __DECONST(char *, spec), (size_t)-1);
|
||||
@@ -113,10 +112,10 @@ do_mount_(const char *spec, const char *dir, int mflag, char *fstype,
|
||||
}
|
||||
|
||||
int
|
||||
do_mount(zfs_handle_t *zhp, const char *mntpt, char *opts, int flags)
|
||||
do_mount(zfs_handle_t *zhp, const char *mntpt, const char *opts, int flags)
|
||||
{
|
||||
|
||||
return (do_mount_(zfs_get_name(zhp), mntpt, flags, MNTTYPE_ZFS, NULL, 0,
|
||||
return (do_mount_(zfs_get_name(zhp), mntpt, flags, NULL, 0,
|
||||
opts, sizeof (mntpt)));
|
||||
}
|
||||
|
||||
|
||||
@@ -180,7 +180,7 @@ out:
|
||||
* otherwise they are considered fatal are copied in to badopt.
|
||||
*/
|
||||
int
|
||||
zfs_parse_mount_options(char *mntopts, unsigned long *mntflags,
|
||||
zfs_parse_mount_options(const char *mntopts, unsigned long *mntflags,
|
||||
unsigned long *zfsflags, int sloppy, char *badopt, char *mtabopt)
|
||||
{
|
||||
int error = 0, quote = 0, flag = 0, count = 0;
|
||||
@@ -320,7 +320,7 @@ zfs_adjust_mount_options(zfs_handle_t *zhp, const char *mntpoint,
|
||||
* make due with return value from the mount process.
|
||||
*/
|
||||
int
|
||||
do_mount(zfs_handle_t *zhp, const char *mntpt, char *opts, int flags)
|
||||
do_mount(zfs_handle_t *zhp, const char *mntpt, const char *opts, int flags)
|
||||
{
|
||||
const char *src = zfs_get_name(zhp);
|
||||
int error = 0;
|
||||
@@ -341,10 +341,10 @@ do_mount(zfs_handle_t *zhp, const char *mntpt, char *opts, int flags)
|
||||
}
|
||||
} else {
|
||||
char *argv[9] = {
|
||||
"/bin/mount",
|
||||
"--no-canonicalize",
|
||||
"-t", MNTTYPE_ZFS,
|
||||
"-o", opts,
|
||||
(char *)"/bin/mount",
|
||||
(char *)"--no-canonicalize",
|
||||
(char *)"-t", (char *)MNTTYPE_ZFS,
|
||||
(char *)"-o", (char *)opts,
|
||||
(char *)src,
|
||||
(char *)mntpt,
|
||||
(char *)NULL };
|
||||
@@ -384,23 +384,17 @@ do_unmount(zfs_handle_t *zhp, const char *mntpt, int flags)
|
||||
return (rv < 0 ? errno : 0);
|
||||
}
|
||||
|
||||
char force_opt[] = "-f";
|
||||
char lazy_opt[] = "-l";
|
||||
char *argv[7] = {
|
||||
"/bin/umount",
|
||||
"-t", MNTTYPE_ZFS,
|
||||
(char *)"/bin/umount",
|
||||
(char *)"-t", (char *)MNTTYPE_ZFS,
|
||||
NULL, NULL, NULL, NULL };
|
||||
int rc, count = 3;
|
||||
|
||||
if (flags & MS_FORCE) {
|
||||
argv[count] = force_opt;
|
||||
count++;
|
||||
}
|
||||
if (flags & MS_FORCE)
|
||||
argv[count++] = (char *)"-f";
|
||||
|
||||
if (flags & MS_DETACH) {
|
||||
argv[count] = lazy_opt;
|
||||
count++;
|
||||
}
|
||||
if (flags & MS_DETACH)
|
||||
argv[count++] = (char *)"-l";
|
||||
|
||||
argv[count] = (char *)mntpt;
|
||||
rc = libzfs_run_process(argv[0], argv, STDOUT_VERBOSE|STDERR_VERBOSE);
|
||||
|
||||
@@ -99,7 +99,7 @@ libzfs_load_module(void)
|
||||
return (0);
|
||||
|
||||
if (access(ZFS_SYSFS_DIR, F_OK) != 0) {
|
||||
char *argv[] = {"modprobe", "zfs", NULL};
|
||||
char *argv[] = {(char *)"modprobe", (char *)"zfs", NULL};
|
||||
if (libzfs_run_process("modprobe", argv, 0))
|
||||
return (ENOEXEC);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user