]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/import/test-qcow2.c
1 /* SPDX-License-Identifier: LGPL-2.1+ */
5 #include "qcow2-util.h"
8 int main(int argc
, char *argv
[]) {
9 _cleanup_close_
int sfd
= -1, dfd
= -1;
13 log_error("Needs two arguments.");
17 sfd
= open(argv
[1], O_RDONLY
|O_CLOEXEC
|O_NOCTTY
);
19 log_error_errno(errno
, "Can't open source file: %m");
23 dfd
= open(argv
[2], O_WRONLY
|O_CREAT
|O_CLOEXEC
|O_NOCTTY
, 0666);
25 log_error_errno(errno
, "Can't open destination file: %m");
29 r
= qcow2_convert(sfd
, dfd
);
31 log_error_errno(r
, "Failed to unpack: %m");