mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-ggsn.git
synced 2025-11-02 13:13:25 +00:00
tun: Use OSMO_STRLCPY_ARRAY
tun->devname buffer is already IFNAMSIZ bytes long, so simplify the code. Change-Id: I40b370f4152748d5acf6ee576462e54c9a46a8a3
This commit is contained in:
@@ -44,6 +44,7 @@
|
|||||||
#include <linux/if_tun.h>
|
#include <linux/if_tun.h>
|
||||||
|
|
||||||
#include <osmocom/core/msgb.h>
|
#include <osmocom/core/msgb.h>
|
||||||
|
#include <osmocom/core/utils.h>
|
||||||
|
|
||||||
#include "tun.h"
|
#include "tun.h"
|
||||||
#include "syserr.h"
|
#include "syserr.h"
|
||||||
@@ -107,8 +108,7 @@ static struct tun_t *tun_alloc_common(const char *devname)
|
|||||||
tun->addrs = 0;
|
tun->addrs = 0;
|
||||||
tun->tundev.fd = -1;
|
tun->tundev.fd = -1;
|
||||||
|
|
||||||
osmo_strlcpy(tun->devname, devname, IFNAMSIZ);
|
OSMO_STRLCPY_ARRAY(tun->devname, devname);
|
||||||
tun->devname[IFNAMSIZ - 1] = 0;
|
|
||||||
|
|
||||||
return tun;
|
return tun;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user