LCOV - code coverage report
Current view: top level - libpkg - pkg_repo_update.c (source / functions) Hit Total Coverage
Test: plop Lines: 6 6 100.0 %
Date: 2024-12-30 07:09:03 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 2 2 100.0 %

           Branch data     Line data    Source code
       1                 :            : /*-
       2                 :            :  * Copyright (c) 2012-2014 Baptiste Daroussin <bapt@FreeBSD.org>
       3                 :            :  * Copyright (c) 2012 Julien Laffaye <jlaffaye@FreeBSD.org>
       4                 :            :  * Copyright (c) 2014 Vsevolod Stakhov <vsevolod@FreeBSD.org>
       5                 :            :  * Copyright (c) 2023 Serenity Cyber Security, LLC
       6                 :            :  *                    Author: Gleb Popov <arrowd@FreeBSD.org>
       7                 :            :  * All rights reserved.
       8                 :            :  *
       9                 :            :  * Redistribution and use in source and binary forms, with or without
      10                 :            :  * modification, are permitted provided that the following conditions
      11                 :            :  * are met:
      12                 :            :  * 1. Redistributions of source code must retain the above copyright
      13                 :            :  *    notice, this list of conditions and the following disclaimer
      14                 :            :  *    in this position and unchanged.
      15                 :            :  * 2. Redistributions in binary form must reproduce the above copyright
      16                 :            :  *    notice, this list of conditions and the following disclaimer in the
      17                 :            :  *    documentation and/or other materials provided with the distribution.
      18                 :            :  *
      19                 :            :  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
      20                 :            :  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
      21                 :            :  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
      22                 :            :  * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
      23                 :            :  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
      24                 :            :  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
      25                 :            :  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
      26                 :            :  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
      27                 :            :  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
      28                 :            :  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
      29                 :            :  */
      30                 :            : 
      31                 :            : #include <sys/stat.h>
      32                 :            : #include <sys/param.h>
      33                 :            : #include <sys/mman.h>
      34                 :            : 
      35                 :            : #include <stdio.h>
      36                 :            : #include <stdlib.h>
      37                 :            : #include <string.h>
      38                 :            : #include <unistd.h>
      39                 :            : #include <errno.h>
      40                 :            : #include <limits.h>
      41                 :            : 
      42                 :            : #include <archive.h>
      43                 :            : #include <archive_entry.h>
      44                 :            : 
      45                 :            : #include "pkg.h"
      46                 :            : #include "private/event.h"
      47                 :            : #include "private/utils.h"
      48                 :            : #include "private/pkgdb.h"
      49                 :            : #include "private/pkg.h"
      50                 :            : 
      51                 :            : int
      52                 :        134 : pkg_update(struct pkg_repo *repo, bool force)
      53                 :            : {
      54                 :        134 :         int rc = repo->ops->update(repo, force);
      55         [ +  + ]:        134 :         if (rc == EPKG_OK) {
      56                 :         72 :                 pkg_plugins_hook_run(PKG_PLUGIN_HOOK_REPO_UPDATE_SUCCESS, repo, NULL);
      57                 :         72 :         }
      58                 :        134 :         return rc;
      59                 :            : }

Generated by: LCOV version 1.15