Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Adrien Gallouët <[email protected]>
  • Loading branch information
angt committed Mar 25, 2020
1 parent 28a978f commit b184dde
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/tun.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,14 @@ tun_create_by_name(char *name, size_t len, const char *dev_name)
static int
tun_create_by_name(char *name, size_t len, const char *dev_name)
{
char tmp[64];
int ret = snprintf(name, len, "%s", dev_name);

if (ret <= 0 || (size_t)ret >= len) {
errno = EINVAL;
return -1;
}

char tmp[64];
ret = snprintf(tmp, sizeof(tmp), "/dev/%s", dev_name);

if (ret <= 0 || (size_t)ret >= sizeof(tmp)) {
Expand Down

0 comments on commit b184dde

Please sign in to comment.