LCOV - code coverage report
Current view: top level - import - test-qcow2.c (source / functions) Hit Total Coverage
Test: systemd_full.info Lines: 0 18 0.0 %
Date: 2019-08-23 13:36:53 Functions: 0 1 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 16 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: LGPL-2.1+ */
       2                 :            : 
       3                 :            : #include <fcntl.h>
       4                 :            : #include <sys/stat.h>
       5                 :            : #include <sys/types.h>
       6                 :            : 
       7                 :            : #include "fd-util.h"
       8                 :            : #include "log.h"
       9                 :            : #include "qcow2-util.h"
      10                 :            : 
      11                 :          0 : int main(int argc, char *argv[]) {
      12                 :          0 :         _cleanup_close_ int sfd = -1, dfd = -1;
      13                 :            :         int r;
      14                 :            : 
      15         [ #  # ]:          0 :         if (argc != 3) {
      16         [ #  # ]:          0 :                 log_error("Needs two arguments.");
      17                 :          0 :                 return EXIT_FAILURE;
      18                 :            :         }
      19                 :            : 
      20                 :          0 :         sfd = open(argv[1], O_RDONLY|O_CLOEXEC|O_NOCTTY);
      21         [ #  # ]:          0 :         if (sfd < 0) {
      22         [ #  # ]:          0 :                 log_error_errno(errno, "Can't open source file: %m");
      23                 :          0 :                 return EXIT_FAILURE;
      24                 :            :         }
      25                 :            : 
      26                 :          0 :         dfd = open(argv[2], O_WRONLY|O_CREAT|O_CLOEXEC|O_NOCTTY, 0666);
      27         [ #  # ]:          0 :         if (dfd < 0) {
      28         [ #  # ]:          0 :                 log_error_errno(errno, "Can't open destination file: %m");
      29                 :          0 :                 return EXIT_FAILURE;
      30                 :            :         }
      31                 :            : 
      32                 :          0 :         r = qcow2_convert(sfd, dfd);
      33         [ #  # ]:          0 :         if (r < 0) {
      34         [ #  # ]:          0 :                 log_error_errno(r, "Failed to unpack: %m");
      35                 :          0 :                 return EXIT_FAILURE;
      36                 :            :         }
      37                 :            : 
      38                 :          0 :         return EXIT_SUCCESS;
      39                 :            : }

Generated by: LCOV version 1.14