chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
importd: add API for exporting container/VM images
[elogind.git]
/
src
/
import
/
import-raw.c
diff --git
a/src/import/import-raw.c
b/src/import/import-raw.c
index 15e5eb2ca274177adf214b27251de5680fcfc224..25b52f7cbd9e5394a25cb0ebf4a48542f092623b 100644
(file)
--- a/
src/import/import-raw.c
+++ b/
src/import/import-raw.c
@@
-117,7
+117,7
@@
int raw_import_new(
i->on_finished = on_finished;
i->userdata = userdata;
i->on_finished = on_finished;
i->userdata = userdata;
- RATELIMIT_INIT(i->progress_rate_limit,
5
00 * USEC_PER_MSEC, 1);
+ RATELIMIT_INIT(i->progress_rate_limit,
1
00 * USEC_PER_MSEC, 1);
i->last_percent = (unsigned) -1;
i->image_root = strdup(image_root ?: "/var/lib/machines");
i->last_percent = (unsigned) -1;
i->image_root = strdup(image_root ?: "/var/lib/machines");
@@
-343,6
+343,9
@@
static int raw_import_process(RawImport *i) {
l = read(i->input_fd, i->buffer + i->buffer_size, sizeof(i->buffer) - i->buffer_size);
if (l < 0) {
l = read(i->input_fd, i->buffer + i->buffer_size, sizeof(i->buffer) - i->buffer_size);
if (l < 0) {
+ if (errno == EAGAIN)
+ return 0;
+
r = log_error_errno(errno, "Failed to read input file: %m");
goto finish;
}
r = log_error_errno(errno, "Failed to read input file: %m");
goto finish;
}
@@
-428,6
+431,10
@@
int raw_import_start(RawImport *i, int fd, const char *local, bool force_local,
if (i->input_fd >= 0)
return -EBUSY;
if (i->input_fd >= 0)
return -EBUSY;
+ r = fd_nonblock(fd, true);
+ if (r < 0)
+ return r;
+
r = free_and_strdup(&i->local, local);
if (r < 0)
return r;
r = free_and_strdup(&i->local, local);
if (r < 0)
return r;