pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_install/files pkg_install-20090727:



details:   https://anonhg.NetBSD.org/pkgsrc/rev/54c1cd65480f
branches:  trunk
changeset: 562603:54c1cd65480f
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Sun Aug 02 17:56:44 2009 +0000

description:
pkg_install-20090727:
Make pkg_install WARNS=4 clean and fix a number of lint warnings.
Based on reports from veego about warnings with older GCC releases in
pkg_delete, where a variable is potentially used uninitialized.

diffstat:

 pkgtools/pkg_install/files/add/perform.c       |   8 ++++----
 pkgtools/pkg_install/files/admin/audit.c       |   6 +++---
 pkgtools/pkg_install/files/admin/main.c        |  13 ++++---------
 pkgtools/pkg_install/files/create/build.c      |   8 ++++----
 pkgtools/pkg_install/files/create/create.h     |   4 ++--
 pkgtools/pkg_install/files/create/main.c       |  11 +++--------
 pkgtools/pkg_install/files/create/perform.c    |   9 +++------
 pkgtools/pkg_install/files/delete/pkg_delete.c |  11 +++++------
 pkgtools/pkg_install/files/info/info.h         |   6 +++---
 pkgtools/pkg_install/files/info/main.c         |   8 ++++----
 pkgtools/pkg_install/files/info/perform.c      |  17 ++++-------------
 pkgtools/pkg_install/files/info/show.c         |  10 +++++-----
 pkgtools/pkg_install/files/lib/conflicts.c     |   5 ++---
 pkgtools/pkg_install/files/lib/decompress.c    |   8 ++++----
 pkgtools/pkg_install/files/lib/fexec.c         |   6 +++---
 pkgtools/pkg_install/files/lib/file.c          |  20 ++++++++++----------
 pkgtools/pkg_install/files/lib/gpgsig.c        |  12 ++++--------
 pkgtools/pkg_install/files/lib/iterate.c       |  11 ++++-------
 pkgtools/pkg_install/files/lib/lib.h           |   9 ++++++---
 pkgtools/pkg_install/files/lib/license.c       |   4 +---
 pkgtools/pkg_install/files/lib/pkcs7.c         |  10 +++-------
 pkgtools/pkg_install/files/lib/pkg_signature.c |  24 ++++++++++++------------
 pkgtools/pkg_install/files/lib/pkgdb.c         |  18 +++++++++---------
 pkgtools/pkg_install/files/lib/plist.c         |  15 ++++++++-------
 pkgtools/pkg_install/files/lib/remove.c        |   7 +++----
 pkgtools/pkg_install/files/lib/var.c           |  10 +++++-----
 pkgtools/pkg_install/files/lib/version.h       |   4 ++--
 27 files changed, 120 insertions(+), 154 deletions(-)

diffs (truncated from 1100 to 300 lines):

diff -r c452e5d7c259 -r 54c1cd65480f pkgtools/pkg_install/files/add/perform.c
--- a/pkgtools/pkg_install/files/add/perform.c  Sun Aug 02 17:31:46 2009 +0000
+++ b/pkgtools/pkg_install/files/add/perform.c  Sun Aug 02 17:56:44 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: perform.c,v 1.87 2009/05/28 08:59:59 joerg Exp $       */
+/*     $NetBSD: perform.c,v 1.88 2009/08/02 17:56:44 joerg Exp $       */
 #if HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -6,7 +6,7 @@
 #if HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
 #endif
-__RCSID("$NetBSD: perform.c,v 1.87 2009/05/28 08:59:59 joerg Exp $");
+__RCSID("$NetBSD: perform.c,v 1.88 2009/08/02 17:56:44 joerg Exp $");
 
 /*-
  * Copyright (c) 2003 Grant Beattie <grant%NetBSD.org@localhost>
@@ -120,7 +120,7 @@
        { offsetof(struct pkg_meta, meta_views), VIEWS_FNAME, 0, 0444 },
        { offsetof(struct pkg_meta, meta_required_by), REQUIRED_BY_FNAME, 0, 0644 },
        { offsetof(struct pkg_meta, meta_installed_info), INSTALLED_INFO_FNAME, 0, 0644 },
-       { 0, NULL, 0 },
+       { 0, NULL, 0, 0 },
 };
 
 static int pkg_do(const char *, int, int);
@@ -780,7 +780,7 @@
                if (fd == -1) {
                        warn("can't open dependency file '%s',"
                            "registration is incomplete!", required_by);
-               } else if (write(fd, text, text_len) != text_len) {
+               } else if (write(fd, text, text_len) != (ssize_t)text_len) {
                        warn("can't write to dependency file `%s'", required_by);
                        close(fd);
                } else if (close(fd) == -1)
diff -r c452e5d7c259 -r 54c1cd65480f pkgtools/pkg_install/files/admin/audit.c
--- a/pkgtools/pkg_install/files/admin/audit.c  Sun Aug 02 17:31:46 2009 +0000
+++ b/pkgtools/pkg_install/files/admin/audit.c  Sun Aug 02 17:56:44 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audit.c,v 1.13 2009/05/10 21:11:43 joerg Exp $ */
+/*     $NetBSD: audit.c,v 1.14 2009/08/02 17:56:44 joerg Exp $ */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -7,7 +7,7 @@
 #if HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
 #endif
-__RCSID("$NetBSD: audit.c,v 1.13 2009/05/10 21:11:43 joerg Exp $");
+__RCSID("$NetBSD: audit.c,v 1.14 2009/08/02 17:56:44 joerg Exp $");
 
 /*-
  * Copyright (c) 2008 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
@@ -379,7 +379,7 @@
                err(EXIT_FAILURE, "Cannot create pkg-vulnerability file %s",
                    pkg_vulnerabilities_file);
 
-       if (write(fd, buf, buf_len) != buf_len)
+       if (write(fd, buf, buf_len) != (ssize_t)buf_len)
                err(EXIT_FAILURE, "Cannot write pkg-vulnerability file");
        if (close(fd) == -1)
                err(EXIT_FAILURE, "Cannot close pkg-vulnerability file after write");
diff -r c452e5d7c259 -r 54c1cd65480f pkgtools/pkg_install/files/admin/main.c
--- a/pkgtools/pkg_install/files/admin/main.c   Sun Aug 02 17:31:46 2009 +0000
+++ b/pkgtools/pkg_install/files/admin/main.c   Sun Aug 02 17:56:44 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.53 2009/05/13 10:51:46 wiz Exp $    */
+/*     $NetBSD: main.c,v 1.54 2009/08/02 17:56:44 joerg Exp $  */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -7,7 +7,7 @@
 #if HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
 #endif
-__RCSID("$NetBSD: main.c,v 1.53 2009/05/13 10:51:46 wiz Exp $");
+__RCSID("$NetBSD: main.c,v 1.54 2009/08/02 17:56:44 joerg Exp $");
 
 /*-
  * Copyright (c) 1999-2008 The NetBSD Foundation, Inc.
@@ -301,7 +301,7 @@
        free(path);
        
        len = strlen(required_by);
-       if (write(fd, required_by, len) != len ||
+       if (write(fd, required_by, len) != (ssize_t)len ||
            write(fd, "\n", 1) != 1 ||
            close(fd) == -1)
                errx(EXIT_FAILURE, "Cannot write to %s", path);
@@ -469,7 +469,7 @@
                        if (show_basename_only)
                                rc = match_local_files(dir, use_default_sfx, 1, basep, lsbasepattern, NULL);
                        else
-                               rc = match_local_files(dir, use_default_sfx, 1, basep, lspattern, (void *)dir);
+                               rc = match_local_files(dir, use_default_sfx, 1, basep, lspattern, __UNCONST(dir));
                        if (rc == -1)
                                errx(EXIT_FAILURE, "Error from match_local_files(\"%s\", \"%s\", ...)",
                                     dir, basep);
@@ -712,8 +712,3 @@
 
        return;
 }
-
-void
-cleanup(int signo)
-{
-}
diff -r c452e5d7c259 -r 54c1cd65480f pkgtools/pkg_install/files/create/build.c
--- a/pkgtools/pkg_install/files/create/build.c Sun Aug 02 17:31:46 2009 +0000
+++ b/pkgtools/pkg_install/files/create/build.c Sun Aug 02 17:56:44 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: build.c,v 1.12 2009/05/13 03:33:50 joerg Exp $ */
+/*     $NetBSD: build.c,v 1.13 2009/08/02 17:56:44 joerg Exp $ */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -7,7 +7,7 @@
 #if HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
 #endif
-__RCSID("$NetBSD: build.c,v 1.12 2009/05/13 03:33:50 joerg Exp $");
+__RCSID("$NetBSD: build.c,v 1.13 2009/08/02 17:56:44 joerg Exp $");
 
 /*-
  * Copyright (c) 2007 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
@@ -150,7 +150,7 @@
        len = archive_entry_size(entry);
 
        while (len > 0) {
-               buf_len = (len > sizeof(buf)) ? sizeof(buf) : (ssize_t)len;
+               buf_len = (len > (off_t)sizeof(buf)) ? (ssize_t)sizeof(buf) : (ssize_t)len;
 
                if ((buf_len = read(fd, buf, buf_len)) == 0)
                        break;
@@ -412,7 +412,7 @@
                    PRESERVE_FNAME, 0444);
        }
        if (create_views)
-               views_file = make_and_add(plist, VIEWS_FNAME, "", 0444);
+               views_file = make_and_add(plist, VIEWS_FNAME, xstrdup(""), 0444);
 
        /* Finally, write out the packing list */
        stringify_plist(plist, &plist_buf, &plist_len, realprefix);
diff -r c452e5d7c259 -r 54c1cd65480f pkgtools/pkg_install/files/create/create.h
--- a/pkgtools/pkg_install/files/create/create.h        Sun Aug 02 17:31:46 2009 +0000
+++ b/pkgtools/pkg_install/files/create/create.h        Sun Aug 02 17:56:44 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: create.h,v 1.12 2009/05/13 03:33:50 joerg Exp $ */
+/* $NetBSD: create.h,v 1.13 2009/08/02 17:56:44 joerg Exp $ */
 
 /* from FreeBSD Id: create.h,v 1.13 1997/10/08 07:46:19 charnier Exp */
 
@@ -55,7 +55,7 @@
 extern char *realprefix;
 extern char *DefaultOwner;
 extern char *DefaultGroup;
-extern char *CompressionType;
+extern const char *CompressionType;
 extern int PlistOnly;
 extern int RelativeLinks;
 extern int update_pkgdb;
diff -r c452e5d7c259 -r 54c1cd65480f pkgtools/pkg_install/files/create/main.c
--- a/pkgtools/pkg_install/files/create/main.c  Sun Aug 02 17:31:46 2009 +0000
+++ b/pkgtools/pkg_install/files/create/main.c  Sun Aug 02 17:56:44 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.15 2009/05/13 03:33:50 joerg Exp $  */
+/*     $NetBSD: main.c,v 1.16 2009/08/02 17:56:44 joerg Exp $  */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -7,7 +7,7 @@
 #if HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
 #endif
-__RCSID("$NetBSD: main.c,v 1.15 2009/05/13 03:33:50 joerg Exp $");
+__RCSID("$NetBSD: main.c,v 1.16 2009/08/02 17:56:44 joerg Exp $");
 
 /*
  * FreeBSD install - a package for the installation and maintainance
@@ -47,7 +47,7 @@
 char   *DefaultOwner = NULL;
 char   *DefaultGroup = NULL;
 char   *realprefix = NULL;
-char   *CompressionType = NULL;
+const char *CompressionType = NULL;
 int    update_pkgdb = 1;
 int    create_views = 0;
 int     PlistOnly = 0;
@@ -70,11 +70,6 @@
        exit(1);
 }
 
-void
-cleanup(int in_signal)
-{
-}
-
 int
 main(int argc, char **argv)
 {
diff -r c452e5d7c259 -r 54c1cd65480f pkgtools/pkg_install/files/create/perform.c
--- a/pkgtools/pkg_install/files/create/perform.c       Sun Aug 02 17:31:46 2009 +0000
+++ b/pkgtools/pkg_install/files/create/perform.c       Sun Aug 02 17:56:44 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: perform.c,v 1.24 2009/02/03 13:15:34 joerg Exp $       */
+/*     $NetBSD: perform.c,v 1.25 2009/08/02 17:56:44 joerg Exp $       */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -7,7 +7,7 @@
 #if HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
 #endif
-__RCSID("$NetBSD: perform.c,v 1.24 2009/02/03 13:15:34 joerg Exp $");
+__RCSID("$NetBSD: perform.c,v 1.25 2009/08/02 17:56:44 joerg Exp $");
 
 /*
  * FreeBSD install - a package for the installation and maintainance
@@ -99,18 +99,15 @@
        int     fd;
 
        if (stat(fname, &sb) == FAIL) {
-               cleanup(0);
                errx(2, "can't stat '%s'", fname);
        }
 
        contents = xmalloc((size_t) (sb.st_size) + 1);
        fd = open(fname, O_RDONLY, 0);
        if (fd == FAIL) {
-               cleanup(0);
                errx(2, "unable to open '%s' for reading", fname);
        }
-       if (read(fd, contents, (size_t) sb.st_size) != (size_t) sb.st_size) {
-               cleanup(0);
+       if (read(fd, contents, (size_t) sb.st_size) != (ssize_t) sb.st_size) {
                errx(2, "short read on '%s' - did not get %lld bytes",
                    fname, (long long) sb.st_size);
        }
diff -r c452e5d7c259 -r 54c1cd65480f pkgtools/pkg_install/files/delete/pkg_delete.c
--- a/pkgtools/pkg_install/files/delete/pkg_delete.c    Sun Aug 02 17:31:46 2009 +0000
+++ b/pkgtools/pkg_install/files/delete/pkg_delete.c    Sun Aug 02 17:56:44 2009 +0000
@@ -34,7 +34,7 @@
 #if HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
 #endif
-__RCSID("$NetBSD: pkg_delete.c,v 1.6 2009/04/24 14:00:25 joerg Exp $");
+__RCSID("$NetBSD: pkg_delete.c,v 1.7 2009/08/02 17:56:44 joerg Exp $");
 
 #if HAVE_ERR_H
 #include <err.h>
@@ -44,10 +44,6 @@
 
 #include "lib.h"
 
-#ifndef __UNCONST
-#define __UNCONST(a)   ((void *)(unsigned long)(const void *)(a))
-#endif
-
 static const char *pkgdb;
 static const char *destdir;
 static const char *prefix;
@@ -531,7 +527,8 @@
        if (rename(fname_tmp, fname) == -1) {
                warn("Unable to rename `%s' to `%s'", fname_tmp, fname);
                rv = 1;
-       }
+       } else
+               rv = 0;
        remove(fname_tmp);
 
        return rv;
@@ -735,6 +732,8 @@
        fname = pkgdb_pkg_file(pkg, VIEWS_FNAME);
        if (fexists(fname))
                is_depoted_pkg = TRUE;
+       else
+               is_depoted_pkg = FALSE;
        free(fname);
 
        if (Fake)
diff -r c452e5d7c259 -r 54c1cd65480f pkgtools/pkg_install/files/info/info.h
--- a/pkgtools/pkg_install/files/info/info.h    Sun Aug 02 17:31:46 2009 +0000
+++ b/pkgtools/pkg_install/files/info/info.h    Sun Aug 02 17:56:44 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: info.h,v 1.19 2009/05/13 03:18:05 joerg Exp $ */
+/* $NetBSD: info.h,v 1.20 2009/08/02 17:56:45 joerg Exp $ */
 
 /* from FreeBSD Id: info.h,v 1.10 1997/02/22 16:09:40 peter Exp */
 
@@ -112,8 +112,8 @@
 extern enum which Which;
 extern Boolean File2Pkg;
 extern Boolean Quiet;
-extern char *InfoPrefix;
-extern char *BuildInfoVariable;
+extern const char *InfoPrefix;
+extern const char *BuildInfoVariable;
 extern size_t termwidth;
 extern lpkg_head_t pkgs;



Home | Main Index | Thread Index | Old Index