]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/import/test-qcow2.c
802588b42742c4ed7050e5f0f9bdbe96405e48e8
1 /* SPDX-License-Identifier: LGPL-2.1+ */
3 Copyright 2015 Lennart Poettering
8 #include "qcow2-util.h"
11 int main(int argc
, char *argv
[]) {
12 _cleanup_close_
int sfd
= -1, dfd
= -1;
16 log_error("Needs two arguments.");
20 sfd
= open(argv
[1], O_RDONLY
|O_CLOEXEC
|O_NOCTTY
);
22 log_error_errno(errno
, "Can't open source file: %m");
26 dfd
= open(argv
[2], O_WRONLY
|O_CREAT
|O_CLOEXEC
|O_NOCTTY
, 0666);
28 log_error_errno(errno
, "Can't open destination file: %m");
32 r
= qcow2_convert(sfd
, dfd
);
34 log_error_errno(r
, "Failed to unpack: %m");