Code

Renamed error recording / logging functions.
[sysdb.git] / src / utils / unixsock.c
index b4b9772a0e9dbe1684abed2e7af3d8b9fad8fc06..08233f8fb23f757a987422e73cd99f5d3dd58817 100644 (file)
@@ -117,7 +117,7 @@ sdb_unixsock_parse_cell(char *string, int type, sdb_data_t *data)
                        data->data.binary.datum = (const unsigned char *)string;
                        break;
                default:
-                       sdb_error_set(SDB_LOG_ERR, "unixsock: Unexpected type %i while "
+                       sdb_log(SDB_LOG_ERR, "unixsock: Unexpected type %i while "
                                        "parsing query result.\n", type);
                        return -1;
        }
@@ -126,13 +126,13 @@ sdb_unixsock_parse_cell(char *string, int type, sdb_data_t *data)
                        || (type == SDB_TYPE_DATETIME)) {
                if (errno || (string == endptr)) {
                        char errbuf[1024];
-                       sdb_error_set(SDB_LOG_ERR, "unixsock: Failed to parse string "
+                       sdb_log(SDB_LOG_ERR, "unixsock: Failed to parse string "
                                        "'%s' as numeric value (type %i): %s\n", string, type,
                                        sdb_strerror(errno, errbuf, sizeof(errbuf)));
                        return -1;
                }
                else if (endptr && (*endptr != '\0'))
-                       sdb_error_set(SDB_LOG_WARNING, "unixsock: Ignoring garbage after "
+                       sdb_log(SDB_LOG_WARNING, "unixsock: Ignoring garbage after "
                                        "number while parsing numeric value (type %i): %s.\n",
                                        type, endptr);
        }
@@ -158,7 +158,7 @@ sdb_unixsock_client_process_one_line(sdb_unixsock_client_t *client,
                char *next;
 
                if (! line) { /* this must no happen */
-                       sdb_error_set(SDB_LOG_ERR, "unixsock: Unexpected EOL while "
+                       sdb_log(SDB_LOG_ERR, "unixsock: Unexpected EOL while "
                                        "parsing line (expected %i columns delimited by '%s'; "
                                        "got %i): %s\n", column_count, delim,
                                        /* last line number */ i, orig_line);
@@ -232,7 +232,7 @@ sdb_unixsock_client_connect(sdb_unixsock_client_t *client)
        fd = socket(AF_UNIX, SOCK_STREAM, /* protocol = */ 0);
        if (fd < 0) {
                char errbuf[1024];
-               sdb_error_set(SDB_LOG_ERR, "unixsock: Failed to open socket: %s\n",
+               sdb_log(SDB_LOG_ERR, "unixsock: Failed to open socket: %s\n",
                                sdb_strerror(errno, errbuf, sizeof(errbuf)));
                return -1;
        }
@@ -243,7 +243,7 @@ sdb_unixsock_client_connect(sdb_unixsock_client_t *client)
 
        if (connect(fd, (struct sockaddr *)&sa, sizeof(sa))) {
                char errbuf[1024];
-               sdb_error_set(SDB_LOG_ERR, "unixsock: Failed to connect to %s: %s\n",
+               sdb_log(SDB_LOG_ERR, "unixsock: Failed to connect to %s: %s\n",
                                sa.sun_path, sdb_strerror(errno, errbuf, sizeof(errbuf)));
                close(fd);
                return -1;
@@ -252,7 +252,7 @@ sdb_unixsock_client_connect(sdb_unixsock_client_t *client)
        client->fh = fdopen(fd, "r+");
        if (! client->fh) {
                char errbuf[1024];
-               sdb_error_set(SDB_LOG_ERR, "unixsock: Failed to open I/O "
+               sdb_log(SDB_LOG_ERR, "unixsock: Failed to open I/O "
                                "stream for %s: %s\n", sa.sun_path,
                                sdb_strerror(errno, errbuf, sizeof(errbuf)));
                close(fd);
@@ -278,7 +278,7 @@ sdb_unixsock_client_send(sdb_unixsock_client_t *client,
        status = fprintf(client->fh, "%s\r\n", msg);
        if (status < 0) {
                char errbuf[1024];
-               sdb_error_set(SDB_LOG_ERR, "unixsock: Failed to write to "
+               sdb_log(SDB_LOG_ERR, "unixsock: Failed to write to "
                                "socket (%s): %s\n", client->path,
                                sdb_strerror(errno, errbuf, sizeof(errbuf)));
                return status;
@@ -300,7 +300,7 @@ sdb_unixsock_client_recv(sdb_unixsock_client_t *client,
        if (! buffer) {
                if (! feof(client->fh)) {
                        char errbuf[1024];
-                       sdb_error_set(SDB_LOG_ERR, "unixsock: Failed to read "
+                       sdb_log(SDB_LOG_ERR, "unixsock: Failed to read "
                                        "from socket (%s): %s\n", client->path,
                                        sdb_strerror(errno, errbuf, sizeof(errbuf)));
                }
@@ -341,7 +341,7 @@ sdb_unixsock_client_process_lines(sdb_unixsock_client_t *client,
                        types[i] = va_arg(ap, int);
 
                        if ((types[i] < 1) || (types[i] > SDB_TYPE_BINARY)) {
-                               sdb_error_set(SDB_LOG_ERR, "unixsock: Unknown column "
+                               sdb_log(SDB_LOG_ERR, "unixsock: Unknown column "
                                                "type %i while processing response from the "
                                                "UNIX socket @ %s.\n", types[i], client->path);
                                va_end(ap);
@@ -374,7 +374,7 @@ sdb_unixsock_client_process_lines(sdb_unixsock_client_t *client,
                column_count = sdb_unixsock_get_column_count(line, delim);
 
                if ((n_cols >= 0) && (n_cols != column_count)) {
-                       sdb_error_set(SDB_LOG_ERR, "unixsock: number of columns (%i) "
+                       sdb_log(SDB_LOG_ERR, "unixsock: number of columns (%i) "
                                        "does not match the number of requested columns (%i) "
                                        "while processing response from the UNIX socket @ %s: "
                                        "%s\n", column_count, n_cols, client->path, line);
@@ -395,7 +395,7 @@ sdb_unixsock_client_process_lines(sdb_unixsock_client_t *client,
                        || ((max_lines < 0) && (! sdb_unixsock_client_eof(client)))
                        || sdb_unixsock_client_error(client)) {
                char errbuf[1024];
-               sdb_error_set(SDB_LOG_ERR, "unixsock: Unexpected end of data while "
+               sdb_log(SDB_LOG_ERR, "unixsock: Unexpected end of data while "
                                "reading from socket (%s): %s\n", client->path,
                                sdb_strerror(errno, errbuf, sizeof(errbuf)));
                return -1;