Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 09e37d536f | |||
| be44229cfe | |||
| c7dbdc1f77 | |||
| 8a4015a3b6 |
@@ -1,3 +1,21 @@
|
||||
2008-10-20 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Released 2.2
|
||||
|
||||
2008-10-20 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Escape commas in fsname option if libfuse supports it
|
||||
|
||||
2008-10-08 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Handle numerical IPv6 addresses enclosed in square brackets.
|
||||
Reported by Andre-John Mas
|
||||
|
||||
* Fix error if username contains a comma character. Reported by
|
||||
Yang Zhang
|
||||
|
||||
* Fix harmless glib assertations with "cache=no"
|
||||
|
||||
2008-07-11 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Released 2.1
|
||||
|
||||
@@ -105,6 +105,9 @@ static void cache_purge_parent(const char *path)
|
||||
|
||||
void cache_invalidate(const char *path)
|
||||
{
|
||||
if (!cache.on)
|
||||
return;
|
||||
|
||||
pthread_mutex_lock(&cache.lock);
|
||||
cache_purge(path);
|
||||
pthread_mutex_unlock(&cache.lock);
|
||||
@@ -163,6 +166,9 @@ void cache_add_attr(const char *path, const struct stat *stbuf, uint64_t wrctr)
|
||||
struct node *node;
|
||||
time_t now;
|
||||
|
||||
if (!cache.on)
|
||||
return;
|
||||
|
||||
pthread_mutex_lock(&cache.lock);
|
||||
if (wrctr == cache.write_ctr) {
|
||||
node = cache_get(path);
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
AC_INIT(sshfs-fuse, 2.1)
|
||||
AC_INIT(sshfs-fuse, 2.2)
|
||||
AM_INIT_AUTOMAKE
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
|
||||
|
||||
@@ -3091,6 +3091,72 @@ static void set_ssh_command(void)
|
||||
}
|
||||
}
|
||||
|
||||
static char *find_base_path(void)
|
||||
{
|
||||
char *s = sshfs.host;
|
||||
char *d = s;
|
||||
|
||||
for (; *s && *s != ':'; s++) {
|
||||
if (*s == '[') {
|
||||
/*
|
||||
* Handle IPv6 numerical address enclosed in square
|
||||
* brackets
|
||||
*/
|
||||
s++;
|
||||
for (; *s != ']'; s++) {
|
||||
if (!*s) {
|
||||
fprintf(stderr, "missing ']' in hostname\n");
|
||||
exit(1);
|
||||
}
|
||||
*d++ = *s;
|
||||
}
|
||||
} else {
|
||||
*d++ = *s;
|
||||
}
|
||||
|
||||
}
|
||||
*d++ = '\0';
|
||||
s++;
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove commas from fsname, as it confuses the fuse option parser.
|
||||
*/
|
||||
static void fsname_remove_commas(char *fsname)
|
||||
{
|
||||
if (strchr(fsname, ',') != NULL) {
|
||||
char *s = fsname;
|
||||
char *d = s;
|
||||
|
||||
for (; *s; s++) {
|
||||
if (*s != ',')
|
||||
*d++ = *s;
|
||||
}
|
||||
*d = *s;
|
||||
}
|
||||
}
|
||||
|
||||
#if FUSE_VERSION >= 27
|
||||
static char *fsname_escape_commas(char *fsnameold)
|
||||
{
|
||||
char *fsname = g_malloc(strlen(fsnameold) * 2 + 1);
|
||||
char *d = fsname;
|
||||
char *s;
|
||||
|
||||
for (s = fsnameold; *s; s++) {
|
||||
if (*s == '\\' || *s == ',')
|
||||
*d++ = '\\';
|
||||
*d++ = *s;
|
||||
}
|
||||
*d = '\0';
|
||||
g_free(fsnameold);
|
||||
|
||||
return fsname;
|
||||
}
|
||||
#endif
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int res;
|
||||
@@ -3148,8 +3214,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
fsname = g_strdup(sshfs.host);
|
||||
base_path = strchr(sshfs.host, ':');
|
||||
*base_path++ = '\0';
|
||||
base_path = find_base_path();
|
||||
if (base_path[0] && base_path[strlen(base_path)-1] != '/')
|
||||
sshfs.base_path = g_strdup_printf("%s/", base_path);
|
||||
else
|
||||
@@ -3211,8 +3276,13 @@ int main(int argc, char *argv[])
|
||||
#if FUSE_VERSION >= 27
|
||||
libver = fuse_version();
|
||||
assert(libver >= 27);
|
||||
if (libver >= 28)
|
||||
fsname = fsname_escape_commas(fsname);
|
||||
else
|
||||
fsname_remove_commas(fsname);
|
||||
tmp = g_strdup_printf("-osubtype=sshfs,fsname=%s", fsname);
|
||||
#else
|
||||
fsname_remove_commas(fsname);
|
||||
tmp = g_strdup_printf("-ofsname=sshfs#%s", fsname);
|
||||
#endif
|
||||
fuse_opt_insert_arg(&args, 1, tmp);
|
||||
|
||||
Reference in New Issue
Block a user