Skip to content
This repository has been archived by the owner on Jan 31, 2024. It is now read-only.

Commit

Permalink
chore: slience some GCC warnings
Browse files Browse the repository at this point in the history
* fuse.c, fuse_lowlevel.c: use memcpy instread of strncpy if we are not
  copying the \0.
* realpath.c: satisfy GCC's size calculation for path: 13 + sizeof(name)
  - 1.
  • Loading branch information
Artoria2e5 committed Oct 12, 2019
1 parent 6aa576a commit 9189a4a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion libfuse-lite/fuse.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ static char *add_name(char *buf, char *s, const char *name)
return NULL;
}
#endif /* __SOLARIS__ */
strncpy(s, name, len);
memcpy(s, name, len);
s--;
*s = '/';

Expand Down
2 changes: 1 addition & 1 deletion libfuse-lite/fuse_lowlevel.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ char *fuse_add_dirent(char *buf, const char *name, const struct stat *stbuf,
dirent->off = off;
dirent->namelen = namelen;
dirent->type = (stbuf->st_mode & 0170000) >> 12;
strncpy(dirent->name, name, namelen);
memcpy(dirent->name, name, namelen);
if (padlen)
memset(buf + entlen, 0, padlen);

Expand Down
2 changes: 1 addition & 1 deletion libntfs-3g/realpath.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ canonicalize_dm_name(const char *ptname, char *canonical)
{
FILE *f;
size_t sz;
char path[MAPPERNAMELTH + 24];
char path[MAPPERNAMELTH + 28];
char name[MAPPERNAMELTH + 16];
char *res = NULL;

Expand Down

0 comments on commit 9189a4a

Please sign in to comment.