summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 44a0aa9)
raw | patch | inline | side by side (parent: 44a0aa9)
author | Sebastian Harl <sh@tokkee.org> | |
Tue, 10 Dec 2013 19:28:47 +0000 (20:28 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Tue, 10 Dec 2013 19:28:47 +0000 (20:28 +0100) |
src/Makefile.am | patch | blob | history | |
src/client/sysdb.c | patch | blob | history |
diff --git a/src/Makefile.am b/src/Makefile.am
index 4bbc3fb582c04be5ff665bd521dac1698d68bf02..e547fa4b543dc873b94b420218303279d3d373ea 100644 (file)
--- a/src/Makefile.am
+++ b/src/Makefile.am
libsysdbclient_la_SOURCES = \
client/client.c include/client/sysdb.h \
client/sock.c include/client/sock.h \
+ utils/error.c include/utils/error.h \
utils/proto.c include/utils/proto.h \
utils/strbuf.c include/utils/strbuf.h
libsysdbclient_la_CFLAGS = $(AM_CFLAGS)
diff --git a/src/client/sysdb.c b/src/client/sysdb.c
index 76e084a2108c541db054d3d914150d09c5b09bf1..fa71eed9d064b04d86037412988e5b10a5c1c7b6 100644 (file)
--- a/src/client/sysdb.c
+++ b/src/client/sysdb.c
#include "client/sysdb.h"
#include "client/sock.h"
+#include "utils/error.h"
+
+#include <errno.h>
#if HAVE_LIBGEN_H
# include <libgen.h>
status = getpwuid_r(uid, &pw_entry, buf, sizeof(buf), &result);
if (status || (! result)) {
- fprintf(stderr, "Failed to determine current username\n");
+ char errbuf[1024];
+ sdb_log(SDB_LOG_ERR, "Failed to determine current username: %s",
+ sdb_strerror(errno, errbuf, sizeof(errbuf)));
return NULL;
}
return result->pw_name;
client = sdb_client_create(host);
if (! client) {
- fprintf(stderr, "Failed to create client object\n");
+ sdb_log(SDB_LOG_ERR, "Failed to create client object");
exit(1);
}
if (sdb_client_connect(client, user)) {
- fprintf(stderr, "Failed to connect to SysDBd\n");
+ sdb_log(SDB_LOG_ERR, "Failed to connect to SysDBd");
sdb_client_destroy(client);
exit(1);
}
- printf("SysDB client "SDB_CLIENT_VERSION_STRING
+ sdb_log(SDB_LOG_INFO, "SysDB client "SDB_CLIENT_VERSION_STRING
SDB_CLIENT_VERSION_EXTRA"\n");
sdb_client_destroy(client);