mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
Fix yet another printf("%s", NULL) case
Fix getpwuid_r() usage Fix virsh migrateuri handling
This commit is contained in:
parent
1c64dc76c1
commit
745c249a61
@ -1,3 +1,11 @@
|
||||
Fri Jan 30 15:34:42 GMT 2009 John Levon <john.levon@sun.com>
|
||||
|
||||
* src/libvirt.c: Fix yet another printf("%s", NULL) case
|
||||
|
||||
* src/util.c: Fix getpwuid_r() usage
|
||||
|
||||
* src/virsh.c: Fix virsh migrateuri handling
|
||||
|
||||
Thu Jan 29 23:01:22 GMT 2009 Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
Misc Xen driver crash/bug fixes
|
||||
|
@ -2691,7 +2691,7 @@ virDomainMigrate (virDomainPtr domain,
|
||||
char *dom_xml = NULL;
|
||||
int cookielen = 0, ret, version = 0;
|
||||
DEBUG("domain=%p, dconn=%p, flags=%lu, dname=%s, uri=%s, bandwidth=%lu",
|
||||
domain, dconn, flags, dname, uri, bandwidth);
|
||||
domain, dconn, flags, NULLSTR(dname), NULLSTR(uri), bandwidth);
|
||||
|
||||
virResetLastError();
|
||||
|
||||
|
11
src/util.c
11
src/util.c
@ -1477,7 +1477,7 @@ char *virGetUserDirectory(virConnectPtr conn,
|
||||
char *strbuf;
|
||||
char *ret;
|
||||
struct passwd pwbuf;
|
||||
struct passwd *pw;
|
||||
struct passwd *pw = NULL;
|
||||
size_t strbuflen = sysconf(_SC_GETPW_R_SIZE_MAX);
|
||||
|
||||
if (VIR_ALLOC_N(strbuf, strbuflen) < 0) {
|
||||
@ -1485,7 +1485,14 @@ char *virGetUserDirectory(virConnectPtr conn,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (getpwuid_r(uid, &pwbuf, strbuf, strbuflen, &pw) != 0) {
|
||||
/*
|
||||
* From the manpage (terrifying but true):
|
||||
*
|
||||
* ERRORS
|
||||
* 0 or ENOENT or ESRCH or EBADF or EPERM or ...
|
||||
* The given name or uid was not found.
|
||||
*/
|
||||
if (getpwuid_r(uid, &pwbuf, strbuf, strbuflen, &pw) != 0 || pw == NULL) {
|
||||
virReportSystemError(conn, errno,
|
||||
_("Failed to find user record for uid '%d'"),
|
||||
uid);
|
||||
|
@ -2258,11 +2258,9 @@ cmdMigrate (vshControl *ctl, const vshCmd *cmd)
|
||||
goto done;
|
||||
}
|
||||
|
||||
migrateuri = vshCommandOptString (cmd, "migrateuri", &found);
|
||||
if (!found) migrateuri = NULL;
|
||||
migrateuri = vshCommandOptString (cmd, "migrateuri", NULL);
|
||||
|
||||
dname = vshCommandOptString (cmd, "dname", &found);
|
||||
if (!found) migrateuri = dname;
|
||||
dname = vshCommandOptString (cmd, "dname", NULL);
|
||||
|
||||
if (vshCommandOptBool (cmd, "live"))
|
||||
flags |= VIR_MIGRATE_LIVE;
|
||||
|
Loading…
Reference in New Issue
Block a user