mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-07 20:24:09 +00:00
Merge pull request #2531 from brauner/2018-08-16/minor_fixes
state: s/sleep()/nanosleep()/
This commit is contained in:
commit
1a1de30d21
@ -100,8 +100,8 @@ static int fillwaitedstates(const char *strstates, lxc_state_t *states)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int lxc_wait(const char *lxcname, const char *states, int timeout,
|
int lxc_wait(const char *lxcname, const char *states, int timeout,
|
||||||
const char *lxcpath)
|
const char *lxcpath)
|
||||||
{
|
{
|
||||||
int state = -1;
|
int state = -1;
|
||||||
lxc_state_t s[MAX_STATE] = {0};
|
lxc_state_t s[MAX_STATE] = {0};
|
||||||
@ -110,6 +110,11 @@ extern int lxc_wait(const char *lxcname, const char *states, int timeout,
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
struct timespec onesec = {
|
||||||
|
.tv_sec = 1,
|
||||||
|
.tv_nsec = 0,
|
||||||
|
};
|
||||||
|
|
||||||
state = lxc_cmd_sock_get_state(lxcname, lxcpath, s, timeout);
|
state = lxc_cmd_sock_get_state(lxcname, lxcpath, s, timeout);
|
||||||
if (state >= 0)
|
if (state >= 0)
|
||||||
break;
|
break;
|
||||||
@ -125,7 +130,7 @@ extern int lxc_wait(const char *lxcname, const char *states, int timeout,
|
|||||||
if (timeout == 0)
|
if (timeout == 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
sleep(1);
|
(void)nanosleep(&onesec, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state < 0) {
|
if (state < 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user