summaryrefslogtreecommitdiff
path: root/src/import
diff options
context:
space:
mode:
Diffstat (limited to 'src/import')
-rw-r--r--src/import/aufs-util.c2
-rw-r--r--src/import/curl-util.c18
-rw-r--r--src/import/export-raw.c4
-rw-r--r--src/import/pull-common.c2
-rw-r--r--src/import/pull-tar.c2
5 files changed, 15 insertions, 13 deletions
diff --git a/src/import/aufs-util.c b/src/import/aufs-util.c
index 7b1ac134a0..82f519958c 100644
--- a/src/import/aufs-util.c
+++ b/src/import/aufs-util.c
@@ -21,10 +21,10 @@
#include <ftw.h>
+#include "aufs-util.h"
#include "rm-rf.h"
#include "string-util.h"
#include "util.h"
-#include "aufs-util.h"
static int nftw_cb(
const char *fpath,
diff --git a/src/import/curl-util.c b/src/import/curl-util.c
index 4278466df1..8e531a64fa 100644
--- a/src/import/curl-util.c
+++ b/src/import/curl-util.c
@@ -48,9 +48,7 @@ static int curl_glue_on_io(sd_event_source *s, int fd, uint32_t revents, void *u
assert(s);
assert(g);
- translated_fd = PTR_TO_INT(hashmap_get(g->translate_fds, INT_TO_PTR(fd+1)));
- assert(translated_fd > 0);
- translated_fd--;
+ translated_fd = PTR_TO_FD(hashmap_get(g->translate_fds, FD_TO_PTR(fd)));
if ((revents & (EPOLLIN|EPOLLOUT)) == (EPOLLIN|EPOLLOUT))
action = CURL_POLL_INOUT;
@@ -79,7 +77,7 @@ static int curl_glue_socket_callback(CURLM *curl, curl_socket_t s, int action, v
assert(curl);
assert(g);
- io = hashmap_get(g->ios, INT_TO_PTR(s+1));
+ io = hashmap_get(g->ios, FD_TO_PTR(s));
if (action == CURL_POLL_REMOVE) {
if (io) {
@@ -91,8 +89,8 @@ static int curl_glue_socket_callback(CURLM *curl, curl_socket_t s, int action, v
sd_event_source_set_enabled(io, SD_EVENT_OFF);
sd_event_source_unref(io);
- hashmap_remove(g->ios, INT_TO_PTR(s+1));
- hashmap_remove(g->translate_fds, INT_TO_PTR(fd+1));
+ hashmap_remove(g->ios, FD_TO_PTR(s));
+ hashmap_remove(g->translate_fds, FD_TO_PTR(fd));
safe_close(fd);
}
@@ -143,17 +141,17 @@ static int curl_glue_socket_callback(CURLM *curl, curl_socket_t s, int action, v
sd_event_source_set_description(io, "curl-io");
- r = hashmap_put(g->ios, INT_TO_PTR(s+1), io);
+ r = hashmap_put(g->ios, FD_TO_PTR(s), io);
if (r < 0) {
log_oom();
sd_event_source_unref(io);
return -1;
}
- r = hashmap_put(g->translate_fds, INT_TO_PTR(fd+1), INT_TO_PTR(s+1));
+ r = hashmap_put(g->translate_fds, FD_TO_PTR(fd), FD_TO_PTR(s));
if (r < 0) {
log_oom();
- hashmap_remove(g->ios, INT_TO_PTR(s+1));
+ hashmap_remove(g->ios, FD_TO_PTR(s));
sd_event_source_unref(io);
return -1;
}
@@ -229,7 +227,7 @@ CurlGlue *curl_glue_unref(CurlGlue *g) {
fd = sd_event_source_get_io_fd(io);
assert(fd >= 0);
- hashmap_remove(g->translate_fds, INT_TO_PTR(fd+1));
+ hashmap_remove(g->translate_fds, FD_TO_PTR(fd));
safe_close(fd);
sd_event_source_unref(io);
diff --git a/src/import/export-raw.c b/src/import/export-raw.c
index 103d45bf21..28c87594d6 100644
--- a/src/import/export-raw.c
+++ b/src/import/export-raw.c
@@ -20,6 +20,10 @@
***/
#include <sys/sendfile.h>
+
+/* When we include libgen.h because we need dirname() we immediately
+ * undefine basename() since libgen.h defines it as a macro to the POSIX
+ * version which is really broken. We prefer GNU basename(). */
#include <libgen.h>
#undef basename
diff --git a/src/import/pull-common.c b/src/import/pull-common.c
index d6567ba7ee..a83cffffa0 100644
--- a/src/import/pull-common.c
+++ b/src/import/pull-common.c
@@ -165,7 +165,7 @@ static int hash_url(const char *url, char **ret) {
assert(url);
- siphash24((uint8_t *) &h, url, strlen(url), k.bytes);
+ h = siphash24(url, strlen(url), k.bytes);
if (asprintf(ret, "%"PRIx64, h) < 0)
return -ENOMEM;
diff --git a/src/import/pull-tar.c b/src/import/pull-tar.c
index e7fcd293f1..2e48167c54 100644
--- a/src/import/pull-tar.c
+++ b/src/import/pull-tar.c
@@ -19,8 +19,8 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include <sys/prctl.h>
#include <curl/curl.h>
+#include <sys/prctl.h>
#include "sd-daemon.h"