Browse Source

Make sure a share's path is absolute

Using relative paths for shares is not supported, so when manually
assigning a path to a share (instead of parsing a URI), we make
sure the path starts with a '/'.
develop
Damien Goutte-Gattat 5 years ago
parent
commit
e76ef29f5c
  1. 9
      src/secret.c

9
src/secret.c

@ -165,8 +165,13 @@ gfsec_share_set_info(gfsec_share_t *share,
share->scheme = scheme;
if ( authority )
share->authority = xstrdup(authority);
if ( path )
share->path = xstrdup(path);
if ( path ) {
/* Make sure the path is absolute. */
if ( *path != '/' )
xasprintf(&(share->path), "/%s", path);
else
share->path = xstrdup(path);
}
if ( hash )
memcpy(share->hash, hash, 32);

Loading…
Cancel
Save