summaryrefslogtreecommitdiffstats
path: root/utils/nfsidmap
diff options
context:
space:
mode:
authorMateusz Guzik <mguzik@redhat.com>2014-03-11 12:27:52 -0400
committerSteve Dickson <steved@redhat.com>2014-03-11 14:05:35 -0400
commite72d258d0d70fe036a5814c1a13975302cab3f17 (patch)
tree276647a75730ff1e533ec9f962434583b2687c92 /utils/nfsidmap
parent2204097a0a960c88658e28a688eca58c9c5722e4 (diff)
downloadnfs-utils-e72d258d0d70fe036a5814c1a13975302cab3f17.tar.gz
nfs-utils-e72d258d0d70fe036a5814c1a13975302cab3f17.tar.xz
nfs-utils-e72d258d0d70fe036a5814c1a13975302cab3f17.zip
nfsidmap: fix error reporting for nfs4_* family of functions
Errors were logged with xlog_err function relying on errno, but these functions don't set it. Fix the problem by introducing xlog_errno which set errno Signed-off-by: Mateusz Guzik <mguzik@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'utils/nfsidmap')
-rw-r--r--utils/nfsidmap/nfsidmap.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/utils/nfsidmap/nfsidmap.c b/utils/nfsidmap/nfsidmap.c
index e14543c..2518ed6 100644
--- a/utils/nfsidmap/nfsidmap.c
+++ b/utils/nfsidmap/nfsidmap.c
@@ -54,7 +54,7 @@ int id_lookup(char *name_at_domain, key_serial_t key, int type)
sprintf(id, "%u", gid);
}
if (rc < 0)
- xlog_err("id_lookup: %s: failed: %m",
+ xlog_errno(rc, "id_lookup: %s: failed: %m",
(type == USER ? "nfs4_owner_to_uid" : "nfs4_group_owner_to_gid"));
if (rc == 0) {
@@ -95,8 +95,9 @@ int name_lookup(char *id, key_serial_t key, int type)
rc = nfs4_get_default_domain(NULL, domain, NFS4_MAX_DOMAIN_LEN);
if (rc != 0) {
+ xlog_errno(rc,
+ "name_lookup: nfs4_get_default_domain failed: %m");
rc = -1;
- xlog_err("name_lookup: nfs4_get_default_domain failed: %m");
goto out;
}
@@ -108,7 +109,7 @@ int name_lookup(char *id, key_serial_t key, int type)
rc = nfs4_gid_to_name(gid, domain, name, IDMAP_NAMESZ);
}
if (rc < 0)
- xlog_err("name_lookup: %s: failed: %m",
+ xlog_errno(rc, "name_lookup: %s: failed: %m",
(type == USER ? "nfs4_uid_to_name" : "nfs4_gid_to_name"));
if (rc == 0) {
@@ -272,8 +273,8 @@ int main(int argc, char **argv)
}
}
- if (nfs4_init_name_mapping(PATH_IDMAPDCONF)) {
- xlog_err("Unable to create name to user id mappings.");
+ if (rc = nfs4_init_name_mapping(PATH_IDMAPDCONF)) {
+ xlog_errno(rc, "Unable to create name to user id mappings.");
return 1;
}
if (!verbose)