mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-14 22:34:41 +00:00
cmd: Do not reassign variable before it is used
cppcheck emits warning Variable 'ofd' is reassigned a value before the old one has been used. We do not need to initialise a variable if it is assigned to on first use. Signed-off-by: Tobin C. Harding <me@tobin.cc>
This commit is contained in:
parent
86cea5d143
commit
ba464e9b66
@ -862,12 +862,12 @@ again:
|
|||||||
static char *lxc_secure_rename_in_ns(int pid, char *oldname, char *newname,
|
static char *lxc_secure_rename_in_ns(int pid, char *oldname, char *newname,
|
||||||
int *container_veth_ifidx)
|
int *container_veth_ifidx)
|
||||||
{
|
{
|
||||||
int ret;
|
int ofd, ret;
|
||||||
pid_t pid_self;
|
pid_t pid_self;
|
||||||
uid_t ruid, suid, euid;
|
uid_t ruid, suid, euid;
|
||||||
char ifname[IFNAMSIZ];
|
char ifname[IFNAMSIZ];
|
||||||
char *string_ret = NULL, *name = NULL;
|
char *string_ret = NULL, *name = NULL;
|
||||||
int fd = -1, ifindex = -1, ofd = -1;
|
int fd = -1, ifindex = -1;
|
||||||
|
|
||||||
pid_self = lxc_raw_getpid();
|
pid_self = lxc_raw_getpid();
|
||||||
|
|
||||||
@ -1035,11 +1035,10 @@ struct user_nic_args {
|
|||||||
|
|
||||||
static bool is_privileged_over_netns(int netns_fd)
|
static bool is_privileged_over_netns(int netns_fd)
|
||||||
{
|
{
|
||||||
int ret;
|
int ofd, ret;
|
||||||
pid_t pid_self;
|
pid_t pid_self;
|
||||||
uid_t euid, ruid, suid;
|
uid_t euid, ruid, suid;
|
||||||
bool bret = false;
|
bool bret = false;
|
||||||
int ofd = -1;
|
|
||||||
|
|
||||||
pid_self = lxc_raw_getpid();
|
pid_self = lxc_raw_getpid();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user