Commit 5a7c74c3 authored by Daniel Salzman's avatar Daniel Salzman

Update knot_map_errno usage

parent b9e7ec61
......@@ -111,7 +111,7 @@ int pid_write(const char* fn)
ret = KNOT_ERROR;
close(fd);
} else {
ret = knot_map_errno(errno);
ret = knot_map_errno();
}
return ret;
......
......@@ -549,7 +549,7 @@ int remote_bind(struct sockaddr_storage *addr)
if (listen(sock, TCP_BACKLOG_SIZE) != 0) {
log_error("remote control, failed to listen on '%s'", addr_str);
close(sock);
return knot_map_errno(EADDRINUSE);
return knot_map_errno();
}
return sock;
......
......@@ -805,7 +805,7 @@ int dt_unit_lock(dt_unit_t *unit)
/* Map errors. */
if (ret < 0) {
return knot_map_errno(EINVAL, EAGAIN);
return knot_map_errno();
}
return KNOT_EOK;
......@@ -822,7 +822,7 @@ int dt_unit_unlock(dt_unit_t *unit)
/* Map errors. */
if (ret < 0) {
return knot_map_errno(EINVAL, EAGAIN);
return knot_map_errno();
}
return KNOT_EOK;
......
......@@ -108,7 +108,7 @@ static int journal_create_file(const char *fn, uint16_t max_nodes)
int fd = open(fn, O_RDWR|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
if (fd < 0) {
dbg_journal("journal: failed to create file '%s'\n", fn);
return knot_map_errno(errno);
return knot_map_errno();
}
/* Lock. */
......@@ -202,7 +202,7 @@ static int journal_open_file(journal_t *j)
dbg_journal_verb("journal: open_file '%s'\n", j->path);
if (j->fd < 0) {
if (errno != ENOENT) {
return knot_map_errno(errno);
return knot_map_errno();
}
/* Create new journal file and open if not exists. */
......@@ -220,7 +220,7 @@ static int journal_open_file(journal_t *j)
dbg_journal_verb("journal: locking journal %s\n", j->path);
ret = fcntl(j->fd, F_SETLKW, &lock);
if (ret < 0) {
return knot_map_errno(errno);
return knot_map_errno();
}
/* Read magic bytes. */
......
......@@ -41,7 +41,7 @@ static int socket_create(int family, int type, int proto)
/* Create socket. */
int ret = socket(family, type, proto);
if (ret < 0) {
return knot_map_errno_internal(KNOT_ERROR, EACCES, EINVAL, ENOMEM);
return knot_map_errno();
}
return ret;
......@@ -135,7 +135,7 @@ int net_bound_socket(int type, const struct sockaddr_storage *ss,
const struct sockaddr *sa = (const struct sockaddr *)ss;
int ret = bind(socket, sa, sockaddr_len(sa));
if (ret < 0) {
ret = knot_map_errno_internal(KNOT_ERROR, EADDRINUSE, EADDRNOTAVAIL, EINVAL, EACCES, ENOMEM);
ret = knot_map_errno();
close(socket);
return ret;
}
......@@ -176,8 +176,7 @@ int net_connected_socket(int type, const struct sockaddr_storage *dst_addr,
int ret = connect(socket, sa, sockaddr_len(sa));
if (ret != 0 && errno != EINPROGRESS) {
close(socket);
return knot_map_errno_internal(KNOT_ERROR, EACCES, EADDRINUSE, EAGAIN,
ECONNREFUSED, EISCONN);
return knot_map_errno();
}
return socket;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment