Skip to content

Commit

Permalink
Merge pull request #19 from andys/master
Browse files Browse the repository at this point in the history
Reading file was crashing on binary files (eg. containing nulls)
  • Loading branch information
jmstacey committed May 22, 2012
2 parents 761afed + 4075dc1 commit adc4c84
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions ext/rubyfuse_lib.c
Expand Up @@ -706,10 +706,9 @@ rf_open(const char *path, struct fuse_file_info *fi) {
/* We have the body, now save it the entire contents to our
* opened_file lists. */
newfile = ALLOC(opened_file);
value = StringValueCStr(body);
newfile->size = strlen(value);
newfile->size = RSTRING_LEN(body);
newfile->value = ALLOC_N(char,(newfile->size)+1);
memcpy(newfile->value,value,newfile->size);
memcpy(newfile->value,RSTRING_PTR(body),newfile->size);
newfile->value[newfile->size] = '\0';
newfile->writesize = 0;
newfile->zero_offset = 0;
Expand Down

0 comments on commit adc4c84

Please sign in to comment.