On 10/31/18 12:39 AM, Fam Zheng wrote:
Use error_report for situations that affect user operation (i.e.  we're
actually returning error), and warn_report/warn_report_err when some
less critical error happened but the user operation can still carry on.

For raw_normalize_devicepath, add Error parameter to propagate to
its callers.

Suggested-by: Markus Armbruster <arm...@redhat.com>
Signed-off-by: Fam Zheng <f...@redhat.com>


@@ -214,8 +214,7 @@ static int raw_normalize_devicepath(const char **filename)
      fname = *filename;
      dp = strrchr(fname, '/');
      if (lstat(fname, &sb) < 0) {
-        fprintf(stderr, "%s: stat failed: %s\n",
-            fname, strerror(errno));
+        error_setg(errp, "%s: stat failed: %s", fname, strerror(errno));
          return -errno;

error_setg_errno() is nicer here. In fact, should we have a Coverity script that looks for error_setg(... strerror())?

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Reply via email to