summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjbj <devnull@localhost>1999-04-14 11:28:31 +0000
committerjbj <devnull@localhost>1999-04-14 11:28:31 +0000
commit527e1bc4e0430a08f5a897ecee4feecdd57a6875 (patch)
tree750f887100708b3a9a90865d00d0a1d7cd0c2ba2
parentf5cf7b223f88c4cc975f4778010909209435fdae (diff)
downloadlibrpm-tizen-527e1bc4e0430a08f5a897ecee4feecdd57a6875.tar.gz
librpm-tizen-527e1bc4e0430a08f5a897ecee4feecdd57a6875.tar.bz2
librpm-tizen-527e1bc4e0430a08f5a897ecee4feecdd57a6875.zip
fix: last update transaction set segfault bug in installer.
improved checks for statfs (Tim Mooney). remove inconsistent use of __P((...)) throughout. non-static inline functions caused IRIX cc pain. CPIOERR_CHECK_ERRNO masking caused AIX cc warnings. CVS patchset: 2993 CVS date: 1999/04/14 11:28:31
-rw-r--r--CHANGES8
-rw-r--r--acconfig.h6
-rw-r--r--build/pack.c2
-rw-r--r--configure.in57
-rw-r--r--lib/cpio.h2
-rw-r--r--lib/falloc.c4
-rw-r--r--lib/rpmlib.h2
-rw-r--r--lib/rpmmacro.h32
-rw-r--r--lib/transaction.c18
-rw-r--r--po/rpm.pot50
-rw-r--r--rpmio/rpmmacro.h32
-rw-r--r--system.h10
-rw-r--r--tools/message.c5
-rw-r--r--tools/rpmgettext.c8
-rw-r--r--verify.h2
15 files changed, 158 insertions, 80 deletions
diff --git a/CHANGES b/CHANGES
index 5f4030974..e08fba6b1 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,8 +1,16 @@
+2.94 -> 2.95
+ - fix: last update transaction set segfault bug in installer.
+ - improved checks for statfs (Tim Mooney).
+ - remove inconsistent use of __P((...)) throughout.
+ - non-static inline functions caused IRIX cc pain.
+ - CPIOERR_CHECK_ERRNO masking caused AIX cc warnings.
+
2.93 -> 2.94
- fix: segfault while parsing target string.
- fix: os was not initialized with "--target i586".
- fix: --prefix resurrected.
- non-linux, non-gcc portability fixes (Tim Mooney).
+ - default to static libs only (remove implied support for shared libs).
2.92 -> 2.93
- eliminate old rpmrc configuration syntax.
diff --git a/acconfig.h b/acconfig.h
index 0bec9b873..308a803b5 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -123,6 +123,12 @@
/* statfs in <sys/statfs.h> (for Irix 6.4 systems) */
#undef STATFS_IN_SYS_STATFS
+/* define if struct statfs has the f_bavail member */
+#undef STATFS_HAS_F_BAVAIL
+
+/* define if the statfs() call takes 4 arguments */
+#undef STAT_STATFS4
+
^L
/* Leave that blank line there!! Autoheader needs it.
If you're adding to this file, keep in mind:
diff --git a/build/pack.c b/build/pack.c
index dad770477..062823804 100644
--- a/build/pack.c
+++ b/build/pack.c
@@ -415,7 +415,7 @@ static int cpio_gzip(FD_t fdo, CSA_t *csa) {
static int cpio_copy(FD_t fdo, CSA_t *csa) {
char buf[BUFSIZ];
- size_t nb;
+ ssize_t nb;
while((nb = fdRead(csa->cpioFdIn, buf, sizeof(buf))) > 0) {
if (fdWrite(fdo, buf, nb) != nb) {
diff --git a/configure.in b/configure.in
index 300a3a849..447b2128c 100644
--- a/configure.in
+++ b/configure.in
@@ -334,6 +334,10 @@ fi
AC_SUBST(BUILD_RPMCONVERT)
dnl statfs portability fiddles.
+dnl
+dnl We should really emulate/steal sections of the statfs and struct statfs
+dnl checks from GNU fileutils.
+dnl
AC_CHECK_HEADERS(glob.h)
AC_MSG_CHECKING(for struct statfs)
dnl
@@ -386,6 +390,59 @@ dnl ...no luck. Warn the user of impending doom.
AC_MSG_WARN(not found)
fi
+dnl
+dnl if we found the struct, see if it has the f_bavail member. Some OSes
+dnl don't, including IRIX 6.5+
+dnl
+if test X$found_struct_statfs = Xyes ; then
+AC_MSG_CHECKING(for f_bavail member in struct statfs)
+AC_TRY_COMPILE([
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef STATFS_IN_SYS_VFS
+#include <sys/vfs.h>
+#elif STATFS_IN_SYS_MOUNT
+#include <sys/mouht.h>
+#elif STATFS_IN_SYS_STATFS
+#include <sys/statfs.h>
+#endif ],
+ [struct statfs sfs;
+ sfs.f_bavail = 0;],
+ [AC_MSG_RESULT(yes)
+ AC_DEFINE(STATFS_HAS_F_BAVAIL)],
+ [AC_MSG_RESULT(no)]
+)
+fi
+
+if test X$found_struct_statfs = Xyes ; then
+dnl
+dnl now check to see if we have the 4-argument variant of statfs()
+dnl this pretty much requires AC_TRY_RUN
+dnl
+AC_MSG_CHECKING([if statfs() requires 4 arguments])
+AC_TRY_RUN([
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef STATFS_IN_SYS_VFS
+#include <sys/vfs.h>
+#elif STATFS_IN_SYS_MOUNT
+#include <sys/mouht.h>
+#elif STATFS_IN_SYS_STATFS
+#include <sys/statfs.h>
+#endif
+main() {
+ struct statfs sfs;
+ exit (statfs(".", &sfs, sizeof(sfs), 0));
+}
+],
+ [AC_MSG_RESULT(yes)
+ AC_DEFINE(STAT_STATFS4)],
+ [AC_MSG_RESULT(no)],
+ [AC_MSG_RESULT(no)]
+)
+fi
AC_C_INLINE
diff --git a/lib/cpio.h b/lib/cpio.h
index 503a680d3..16a97b595 100644
--- a/lib/cpio.h
+++ b/lib/cpio.h
@@ -8,7 +8,7 @@
/* Note the CPIO_CHECK_ERRNO bit is set only if errno is valid. These have to
be positive numbers or this setting the high bit stuff is a bad idea. */
-#define CPIOERR_CHECK_ERRNO 0x80000000
+#define CPIOERR_CHECK_ERRNO 0x00008000
#define CPIOERR_BAD_MAGIC (2 )
#define CPIOERR_BAD_HEADER (3 )
diff --git a/lib/falloc.c b/lib/falloc.c
index 0aef17d1f..38b00fea1 100644
--- a/lib/falloc.c
+++ b/lib/falloc.c
@@ -34,11 +34,11 @@ struct faFooter {
unsigned int isFree;
} ;
-inline FD_t faFileno(faFile fa) {
+FD_t faFileno(faFile fa) {
return fa->fd;
}
-inline off_t faLseek(faFile fa, off_t off, int op) {
+off_t faLseek(faFile fa, off_t off, int op) {
return fdLseek(faFileno(fa), off, op);
}
diff --git a/lib/rpmlib.h b/lib/rpmlib.h
index d0b566e1b..4c645dfcb 100644
--- a/lib/rpmlib.h
+++ b/lib/rpmlib.h
@@ -276,7 +276,7 @@ typedef enum rpmCallbackType_e {
RPMCALLBACK_INST_PROGRESS, RPMCALLBACK_INST_START,
RPMCALLBACK_INST_OPEN_FILE, RPMCALLBACK_INST_CLOSE_FILE,
RPMCALLBACK_TRANS_PROGRESS, RPMCALLBACK_TRANS_START, RPMCALLBACK_TRANS_STOP,
- RPMCALLBACK_UNINST_PROGRESS, RPMCALLBACK_UNINST_START, RPMCALLBACK_UNINST_STOP,
+ RPMCALLBACK_UNINST_PROGRESS, RPMCALLBACK_UNINST_START, RPMCALLBACK_UNINST_STOP
} rpmCallbackType;
typedef void * (*rpmCallbackFunction)(const Header h,
const rpmCallbackType what,
diff --git a/lib/rpmmacro.h b/lib/rpmmacro.h
index 86be34fb4..0be26c589 100644
--- a/lib/rpmmacro.h
+++ b/lib/rpmmacro.h
@@ -29,39 +29,31 @@ typedef /*@abstract@*/ struct MacroContext {
#define RMIL_OLDSPEC -1
#define RMIL_GLOBAL 0
-#ifndef __P
-#ifdef __STDC__
-#define __P(protos) protos
-#else
-#define __P(protos) ()
-#endif
-#endif
-
#ifdef __cplusplus
extern "C" {
#endif
-void dumpMacroTable __P((MacroContext *mc, FILE *f));
+void dumpMacroTable (MacroContext *mc, FILE *f);
/* XXX this is used only in build/expression.c and will go away. */
-const char *getMacroBody __P((MacroContext *mc, const char *name));
+const char *getMacroBody (MacroContext *mc, const char *name);
-int expandMacros __P((void *spec, MacroContext *mc, char *sbuf, size_t sbuflen));
-void addMacro __P((MacroContext *mc, const char *n, const char *o, const char *b, int depth));
-void delMacro __P((MacroContext *mc, const char *n));
+int expandMacros (void *spec, MacroContext *mc, char *sbuf, size_t sbuflen);
+void addMacro (MacroContext *mc, const char *n, const char *o, const char *b, int depth);
+void delMacro (MacroContext *mc, const char *n);
-int rpmDefineMacro __P((MacroContext *mc, const char *macro, int level));
-void initMacros __P((MacroContext *mc, const char *macrofile));
-void freeMacros __P((MacroContext *mc));
+int rpmDefineMacro (MacroContext *mc, const char *macro, int level);
+void initMacros (MacroContext *mc, const char *macrofile);
+void freeMacros (MacroContext *mc);
#define COMPRESSED_NOT 0
#define COMPRESSED_OTHER 1
#define COMPRESSED_BZIP2 2
-int isCompressed __P((const char *file, int *compressed));
+int isCompressed (const char *file, int *compressed);
-char * rpmExpand __P((const char *arg, ...));
-const char *rpmGetPath __P((const char *path, ...));
-int rpmExpandNumeric __P((const char *arg));
+char * rpmExpand (const char *arg, ...);
+const char *rpmGetPath (const char *path, ...);
+int rpmExpandNumeric (const char *arg);
#ifdef __cplusplus
}
diff --git a/lib/transaction.c b/lib/transaction.c
index baffedbd3..ee227fe5b 100644
--- a/lib/transaction.c
+++ b/lib/transaction.c
@@ -182,12 +182,30 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify,
di = alloca(sizeof(*di) * (filesystemCount + 1));
for (i = 0; (i < filesystemCount) && di; i++) {
+#ifdef STAT_STATFS4
+/* this platform has the 4-argument version of the statfs call. The last two
+ * should be the size of struct statfs and 0, respectively. The 0 is the
+ * filesystem type, and is always 0 when statfs is called on a mounted
+ * filesystem, as we're doing.
+ */
+ if (statfs(filesystems[i], &sfb, sizeof(sfb), 0)) {
+#else
if (statfs(filesystems[i], &sfb)) {
+#endif
di = NULL;
} else {
di[i].block = sfb.f_bsize;
di[i].needed = 0;
+#ifdef STATFS_HAS_F_BAVAIL
di[i].avail = sfb.f_bavail;
+#else
+/* FIXME: the statfs struct doesn't have a member to tell how many blocks are
+ * available for non-superusers. f_blocks - f_bfree is probably too big, but
+ * it's about all we can do.
+ */
+ di[i].avail = sfb.f_blocks - sfb.f_bfree;
+#endif
+
stat(filesystems[i], &sb);
di[i].dev = sb.st_dev;
diff --git a/po/rpm.pot b/po/rpm.pot
index 0a5986414..f6ee59cfa 100644
--- a/po/rpm.pot
+++ b/po/rpm.pot
@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 1999-04-09 18:32-0400\n"
+"POT-Creation-Date: 1999-04-14 06:46-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -2441,101 +2441,101 @@ msgstr ""
msgid "(unknown type)"
msgstr ""
-#: ../lib/install.c:100
+#: ../lib/install.c:95
msgid "source package expected, binary found"
msgstr ""
-#: ../lib/install.c:182 ../lib/uninstall.c:111
+#: ../lib/install.c:171 ../lib/uninstall.c:111
#, c-format
msgid " file: %s action: %s\n"
msgstr ""
-#: ../lib/install.c:199
+#: ../lib/install.c:188
#, c-format
msgid "user %s does not exist - using root"
msgstr ""
-#: ../lib/install.c:207
+#: ../lib/install.c:196
#, c-format
msgid "group %s does not exist - using root"
msgstr ""
-#: ../lib/install.c:234
+#: ../lib/install.c:223
msgid "%%instchangelog value in macro file should be a number, but isn't"
msgstr ""
-#: ../lib/install.c:302
+#: ../lib/install.c:291
#, c-format
msgid "package: %s-%s-%s files test = %d\n"
msgstr ""
-#: ../lib/install.c:365
+#: ../lib/install.c:354
msgid "stopping install as we're running --test\n"
msgstr ""
-#: ../lib/install.c:370
+#: ../lib/install.c:359
msgid "running preinstall script (if any)\n"
msgstr ""
-#: ../lib/install.c:400
+#: ../lib/install.c:389
#, c-format
msgid "warning: %s created as %s"
msgstr ""
-#: ../lib/install.c:436
+#: ../lib/install.c:425
#, c-format
msgid "warning: %s saved as %s"
msgstr ""
-#: ../lib/install.c:440 ../lib/install.c:806 ../lib/uninstall.c:337
+#: ../lib/install.c:429 ../lib/install.c:792 ../lib/uninstall.c:337
#, c-format
msgid "rename of %s to %s failed: %s"
msgstr ""
-#: ../lib/install.c:523
+#: ../lib/install.c:509
msgid "running postinstall script (if any)\n"
msgstr ""
#. this would probably be a good place to check if disk space
#. was used up - if so, we should return a different error
-#: ../lib/install.c:629
+#: ../lib/install.c:615
#, c-format
msgid "unpacking of archive failed%s%s: %s"
msgstr ""
-#: ../lib/install.c:630
+#: ../lib/install.c:616
msgid " on file "
msgstr ""
-#: ../lib/install.c:670
+#: ../lib/install.c:656
msgid "installing a source package\n"
msgstr ""
-#: ../lib/install.c:681 ../lib/install.c:703
+#: ../lib/install.c:667 ../lib/install.c:689
#, c-format
msgid "cannot create %s"
msgstr ""
-#: ../lib/install.c:688 ../lib/install.c:710
+#: ../lib/install.c:674 ../lib/install.c:696
#, c-format
msgid "cannot write to %s"
msgstr ""
-#: ../lib/install.c:692
+#: ../lib/install.c:678
#, c-format
msgid "sources in: %s\n"
msgstr ""
-#: ../lib/install.c:714
+#: ../lib/install.c:700
#, c-format
msgid "spec file in: %s\n"
msgstr ""
-#: ../lib/install.c:747 ../lib/install.c:783
+#: ../lib/install.c:733 ../lib/install.c:769
msgid "source package contains no .spec file"
msgstr ""
-#: ../lib/install.c:804
+#: ../lib/install.c:790
#, c-format
msgid "renaming %s to %s\n"
msgstr ""
@@ -3202,17 +3202,17 @@ msgstr ""
msgid "Invalid %%_signature spec in macro file"
msgstr ""
-#: ../lib/transaction.c:736
+#: ../lib/transaction.c:778
#, c-format
msgid "relocating %s to %s\n"
msgstr ""
-#: ../lib/transaction.c:742
+#: ../lib/transaction.c:784
#, c-format
msgid "excluding %s\n"
msgstr ""
-#: ../lib/transaction.c:830
+#: ../lib/transaction.c:872
#, c-format
msgid "%s skipped due to missingok flag\n"
msgstr ""
diff --git a/rpmio/rpmmacro.h b/rpmio/rpmmacro.h
index 86be34fb4..0be26c589 100644
--- a/rpmio/rpmmacro.h
+++ b/rpmio/rpmmacro.h
@@ -29,39 +29,31 @@ typedef /*@abstract@*/ struct MacroContext {
#define RMIL_OLDSPEC -1
#define RMIL_GLOBAL 0
-#ifndef __P
-#ifdef __STDC__
-#define __P(protos) protos
-#else
-#define __P(protos) ()
-#endif
-#endif
-
#ifdef __cplusplus
extern "C" {
#endif
-void dumpMacroTable __P((MacroContext *mc, FILE *f));
+void dumpMacroTable (MacroContext *mc, FILE *f);
/* XXX this is used only in build/expression.c and will go away. */
-const char *getMacroBody __P((MacroContext *mc, const char *name));
+const char *getMacroBody (MacroContext *mc, const char *name);
-int expandMacros __P((void *spec, MacroContext *mc, char *sbuf, size_t sbuflen));
-void addMacro __P((MacroContext *mc, const char *n, const char *o, const char *b, int depth));
-void delMacro __P((MacroContext *mc, const char *n));
+int expandMacros (void *spec, MacroContext *mc, char *sbuf, size_t sbuflen);
+void addMacro (MacroContext *mc, const char *n, const char *o, const char *b, int depth);
+void delMacro (MacroContext *mc, const char *n);
-int rpmDefineMacro __P((MacroContext *mc, const char *macro, int level));
-void initMacros __P((MacroContext *mc, const char *macrofile));
-void freeMacros __P((MacroContext *mc));
+int rpmDefineMacro (MacroContext *mc, const char *macro, int level);
+void initMacros (MacroContext *mc, const char *macrofile);
+void freeMacros (MacroContext *mc);
#define COMPRESSED_NOT 0
#define COMPRESSED_OTHER 1
#define COMPRESSED_BZIP2 2
-int isCompressed __P((const char *file, int *compressed));
+int isCompressed (const char *file, int *compressed);
-char * rpmExpand __P((const char *arg, ...));
-const char *rpmGetPath __P((const char *path, ...));
-int rpmExpandNumeric __P((const char *arg));
+char * rpmExpand (const char *arg, ...);
+const char *rpmGetPath (const char *path, ...);
+int rpmExpandNumeric (const char *arg);
#ifdef __cplusplus
}
diff --git a/system.h b/system.h
index db83f40e9..f799299da 100644
--- a/system.h
+++ b/system.h
@@ -78,14 +78,6 @@ extern time_t timezone;
#include <utime.h>
#endif
-#ifndef __P
-#if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
-#define __P(args) args
-#else
-#define __P(args) ()
-#endif /* GCC. */
-#endif /* Not __P. */
-
/* Don't use bcopy! Use memmove if source and destination may overlap,
memcpy otherwise. */
@@ -111,7 +103,7 @@ extern int errno;
/*@=skipansiheaders@*/
#undef getopt
#else /* not STDC_HEADERS */
-char *getenv __P((const char *name));
+char *getenv (const char *name);
#endif /* STDC_HEADERS */
#ifdef HAVE_FCNTL_H
diff --git a/tools/message.c b/tools/message.c
index e381a291e..acbcb8d2b 100644
--- a/tools/message.c
+++ b/tools/message.c
@@ -43,6 +43,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "error.h"
#include "libgettext.h"
+#ifndef HAVE_STPCPY
+/* we're using our version, so provide a prototype for stpcpy and stpncpy */
+extern char * stpcpy( char *dest, const char * src);
+extern char * stpncpy( char *dest, const char * src, size_t n);
+#endif
/* Our regular abbreviation. */
#define _(str) gettext (str)
diff --git a/tools/rpmgettext.c b/tools/rpmgettext.c
index e527c1258..e04d206bc 100644
--- a/tools/rpmgettext.c
+++ b/tools/rpmgettext.c
@@ -11,6 +11,14 @@
#include "signature.h"
#include "header.h"
+/* include libgen.h here and only here! It has the prototype for basename()
+ * on many OSes, but some of the prototypes in libgen.h clash with prototypes
+ * from other header files (e.g. regex.h) on some OSes (e.g. AIX 4.x).
+ */
+#ifdef HAVE_LIBGEN_H
+#include <libgen.h>
+#endif
+
#define MYDEBUG 2
#ifdef MYDEBUG
diff --git a/verify.h b/verify.h
index 9ded9ac70..4b01be407 100644
--- a/verify.h
+++ b/verify.h
@@ -9,7 +9,7 @@
#define VERIFY_MD5 (1 << 3)
enum verifysources { VERIFY_PATH, VERIFY_PACKAGE, VERIFY_EVERY, VERIFY_RPM,
- VERIFY_GRP, };
+ VERIFY_GRP };
int doVerify(const char * prefix, enum verifysources source, const char ** argv,
int verifyFlags);