From: Ralph Ronnquist Date: Mon, 7 Aug 2023 04:29:20 +0000 (+1000) Subject: Allow for fragment pathnames including "/" without range appendix. X-Git-Tag: 1.1~1 X-Git-Url: https://git.rrq.au/?a=commitdiff_plain;h=5101a793944fe2285cd5077897bc15c3f1681349;p=rrq%2Ffusefile.git Allow for fragment pathnames including "/" without range appendix. --- diff --git a/fusefile.c b/fusefile.c index f6d7bc8..37f8a2c 100644 --- a/fusefile.c +++ b/fusefile.c @@ -295,8 +295,14 @@ static int RANGE(int s,int n ) { static int setup_source(struct Source *p,char *frag) { struct stat filestat; // Open the fragment file rw if possible, else ro - range = strrchr( frag, '/' ); // last '/' - p->filename = range? strndup( frag, range - frag ) : frag; + // First try the fragment in full, thereafter with range appendix + if ( stat( frag, &filestat ) == 0 ) { + p->filename = strdup( frag ); + range = 0; + } else { + range = strrchr( frag, '/' ); // last '/' + p->filename = range? strndup( frag, range - frag ) : frag; + } p->fd = open( p->filename, O_RDWR ); int rdonly = 0; if ( p->fd < 0 ) { @@ -307,7 +313,7 @@ static int setup_source(struct Source *p,char *frag) { perror( p->filename ); return 1; // Error return } - if ( stat( p->filename, &filestat ) ) { + if ( ( range == 0 ) && stat( p->filename, &filestat ) ) { perror( p->filename ); return 1; }