Re: [PATCH 10/75] libxl: Drop virAsprintf() and virAsprintfQuiet() retval checking

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 22, 2019 at 03:57:14PM +0200, Michal Privoznik wrote:
These functions can't fail really. Drop checking of their retval
then.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
src/libxl/libxl_conf.c      | 34 +++++++++++-----------------------
src/libxl/libxl_domain.c    | 35 +++++++++++++----------------------
src/libxl/libxl_domain.h    |  2 +-
src/libxl/libxl_driver.c    | 19 +++++++------------
src/libxl/libxl_logger.c    | 11 ++++-------
src/libxl/libxl_migration.c |  9 +++------
src/libxl/xen_common.c      | 11 +++++------
src/libxl/xen_xl.c          | 18 ++++++------------
src/libxl/xen_xm.c          |  6 ++----
9 files changed, 52 insertions(+), 93 deletions(-)

@@ -931,7 +931,7 @@ libxlDomainCleanup(libxlDriverPrivatePtr driver,
 *
 * virDomainObjPtr must be locked on invocation
 */
-int
+void

Changing the return type can be done later,

libxlDomainAutoCoreDump(libxlDriverPrivatePtr driver,
                        virDomainObjPtr vm)
{
@@ -940,28 +940,19 @@ libxlDomainAutoCoreDump(libxlDriverPrivatePtr driver,
    char timestr[100];
    struct tm time_info;
    char *dumpfile = NULL;
-    int ret = -1;

    localtime_r(&curtime, &time_info);
    strftime(timestr, sizeof(timestr), "%Y-%m-%d-%H:%M:%S", &time_info);

-    if (virAsprintf(&dumpfile, "%s/%s-%s",
-                    cfg->autoDumpDir,
-                    vm->def->name,
-                    timestr) < 0)
-        goto cleanup;
+    virAsprintf(&dumpfile, "%s/%s-%s", cfg->autoDumpDir, vm->def->name,
+                timestr);

    /* Unlock virDomainObj while dumping core */
    virObjectUnlock(vm);
    libxl_domain_core_dump(cfg->ctx, vm->def->id, dumpfile, NULL);
    virObjectLock(vm);

-    ret = 0;

for now, you can just leave this ret = 0 here.

Jano

-
- cleanup:
    VIR_FREE(dumpfile);
-
-    return ret;
}

int

Attachment: signature.asc
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux