mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-04-26 15:14:42 +00:00
openvz: Fix regression in openvzGetVPSUUID
Commit f044376530f313a replaced openvz_readline with getline and changed EOF-handling in the openvzGetVPSUUID. This patch restores original EOF-handling. Reported by Jean-Baptiste Rouault.
This commit is contained in:
parent
971267c680
commit
89fcf6f3f0
@ -863,7 +863,6 @@ openvzGetVPSUUID(int vpsid, char *uuidstr, size_t len)
|
|||||||
char *conf_file;
|
char *conf_file;
|
||||||
char *line = NULL;
|
char *line = NULL;
|
||||||
size_t line_size = 0;
|
size_t line_size = 0;
|
||||||
ssize_t ret;
|
|
||||||
char *saveptr = NULL;
|
char *saveptr = NULL;
|
||||||
char *uuidbuf;
|
char *uuidbuf;
|
||||||
char *iden;
|
char *iden;
|
||||||
@ -878,13 +877,13 @@ openvzGetVPSUUID(int vpsid, char *uuidstr, size_t len)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
ret = getline(&line, &line_size, fp);
|
if (getline(&line, &line_size, fp) < 0) {
|
||||||
if (ret == -1)
|
if (feof(fp)) { /* EOF, UUID was not found */
|
||||||
goto cleanup;
|
uuidstr[0] = 0;
|
||||||
|
break;
|
||||||
if (ret == 0) { /* EoF, UUID was not found */
|
} else {
|
||||||
uuidstr[0] = 0;
|
goto cleanup;
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
iden = strtok_r(line, " ", &saveptr);
|
iden = strtok_r(line, " ", &saveptr);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user