Skip to content

Commit

Permalink
Remedy gcc 7.4.0 warnings (#187)
Browse files Browse the repository at this point in the history
* 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]
  • Loading branch information
kalvdans authored and Nikratio committed Nov 3, 2019
1 parent e1a9050 commit 0119863
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sshfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 0119863

Please sign in to comment.