Remedy gcc 7.4.0 warnings (#187)

* Use logical not for booleans

Fixes a gcc 7.4.0 complaint:

sshfs.c:1743:28: warning: ‘~’ on a boolean expression [-Wbool-operation]
sshfs.c:1743:28: note: did you mean to use logical not?

* strdup argument to keep it alive after function return

Fixes gcc 7.4.0 complaint:

sshfs.c: In function ‘sshfs_opt_proc’:
sshfs.c:3488:50: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
This commit is contained in:
kalvdans 2019-11-03 10:28:37 +01:00 committed by Nikolaus Rath
parent e1a9050c61
commit 011986306b
1 changed files with 2 additions and 2 deletions

View File

@ -1745,7 +1745,7 @@ static void *sshfs_init(struct fuse_conn_info *conn,
sshfs.sync_read = 1;
// These workarounds require the "path" argument.
cfg->nullpath_ok = ~(sshfs.truncate_workaround || sshfs.fstat_workaround);
cfg->nullpath_ok = !(sshfs.truncate_workaround || sshfs.fstat_workaround);
// Lookup of . and .. is supported
conn->capable |= FUSE_CAP_EXPORT_SUPPORT;
@ -3494,7 +3494,7 @@ static int sshfs_opt_proc(void *data, const char *arg, int key,
* mountpoint to later be completely
* unprivileged with libfuse >= 3.3.0.
*/
sshfs.mountpoint = arg;
sshfs.mountpoint = strdup(arg);
} else {
sshfs.mountpoint = realpath(arg, NULL);
}