Fix some defects found by covscan
This commit is contained in:
parent
8047fa8580
commit
0b929f0f8b
@ -1,7 +1,29 @@
|
||||
diff -up db-5.3.28/src/env/env_region.c.pthreads db-5.3.28/src/env/env_region.c
|
||||
--- db-5.3.28/src/env/env_region.c.pthreads 2017-06-19 08:48:19.362325045 +0200
|
||||
+++ db-5.3.28/src/env/env_region.c 2017-06-19 08:49:38.910773653 +0200
|
||||
@@ -305,15 +305,7 @@ user_map_functions:
|
||||
diff -up db-5.3.28/src/dbinc_auto/int_def.in.pthreads_ppc db-5.3.28/src/dbinc_auto/int_def.in
|
||||
--- db-5.3.28/src/dbinc_auto/int_def.in.pthreads_ppc 2017-06-26 15:06:09.282020804 +0200
|
||||
+++ db-5.3.28/src/dbinc_auto/int_def.in 2017-06-26 15:06:22.238771039 +0200
|
||||
@@ -1572,6 +1572,7 @@
|
||||
#define __os_strerror __os_strerror@DB_VERSION_UNIQUE_NAME@
|
||||
#define __os_posix_err __os_posix_err@DB_VERSION_UNIQUE_NAME@
|
||||
#define __os_fileid __os_fileid@DB_VERSION_UNIQUE_NAME@
|
||||
+#define __check_lock_fn __check_lock_fn@DB_VERSION_UNIQUE_NAME@
|
||||
#define __os_fdlock __os_fdlock@DB_VERSION_UNIQUE_NAME@
|
||||
#define __os_fsync __os_fsync@DB_VERSION_UNIQUE_NAME@
|
||||
#define __os_getenv __os_getenv@DB_VERSION_UNIQUE_NAME@
|
||||
diff -up db-5.3.28/src/dbinc_auto/os_ext.h.pthreads_ppc db-5.3.28/src/dbinc_auto/os_ext.h
|
||||
--- db-5.3.28/src/dbinc_auto/os_ext.h.pthreads_ppc 2017-06-26 15:05:23.792897700 +0200
|
||||
+++ db-5.3.28/src/dbinc_auto/os_ext.h 2017-06-26 15:06:22.172772311 +0200
|
||||
@@ -41,6 +41,7 @@ void __os_set_errno __P((int));
|
||||
char *__os_strerror __P((int, char *, size_t));
|
||||
int __os_posix_err __P((int));
|
||||
int __os_fileid __P((ENV *, const char *, int, u_int8_t *));
|
||||
+int __check_lock_fn __P((char *, pid_t));
|
||||
int __os_fdlock __P((ENV *, DB_FH *, off_t, db_lockmode_t, int));
|
||||
int __os_fsync __P((ENV *, DB_FH *));
|
||||
int __os_getenv __P((ENV *, const char *, char **, size_t));
|
||||
diff -up db-5.3.28/src/env/env_region.c.pthreads_ppc db-5.3.28/src/env/env_region.c
|
||||
--- db-5.3.28/src/env/env_region.c.pthreads_ppc 2017-06-26 15:04:40.805726365 +0200
|
||||
+++ db-5.3.28/src/env/env_region.c 2017-06-26 15:04:40.807726326 +0200
|
||||
@@ -305,14 +305,6 @@ user_map_functions:
|
||||
goto creation;
|
||||
}
|
||||
|
||||
@ -16,7 +38,6 @@ diff -up db-5.3.28/src/env/env_region.c.pthreads db-5.3.28/src/env/env_region.c
|
||||
if (renv->majver != DB_VERSION_MAJOR ||
|
||||
renv->minver != DB_VERSION_MINOR) {
|
||||
/*
|
||||
* Special case a region that's all nul bytes, just treat it
|
||||
@@ -337,6 +329,20 @@ user_map_functions:
|
||||
goto err;
|
||||
}
|
||||
@ -38,10 +59,10 @@ diff -up db-5.3.28/src/env/env_region.c.pthreads db-5.3.28/src/env/env_region.c
|
||||
/*
|
||||
* Check if the environment has had a catastrophic failure.
|
||||
*
|
||||
diff -up db-5.3.28/src/os/os_flock.c.pthreads db-5.3.28/src/os/os_flock.c
|
||||
--- db-5.3.28/src/os/os_flock.c.pthreads 2017-06-19 08:48:19.362325045 +0200
|
||||
+++ db-5.3.28/src/os/os_flock.c 2017-06-19 08:48:19.364325006 +0200
|
||||
@@ -15,6 +15,67 @@ static int __os_filelocking_notsup __P((
|
||||
diff -up db-5.3.28/src/os/os_flock.c.pthreads_ppc db-5.3.28/src/os/os_flock.c
|
||||
--- db-5.3.28/src/os/os_flock.c.pthreads_ppc 2017-06-26 15:04:40.806726346 +0200
|
||||
+++ db-5.3.28/src/os/os_flock.c 2017-06-26 15:04:40.807726326 +0200
|
||||
@@ -15,6 +15,70 @@ static int __os_filelocking_notsup __P((
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -51,6 +72,7 @@ diff -up db-5.3.28/src/os/os_flock.c.pthreads db-5.3.28/src/os/os_flock.c
|
||||
+ * the lock has the same pid value as 'pid'.
|
||||
+ *
|
||||
+ * Returns 0 if a lock on fn is found, 1 if it is not found and -1 on error.
|
||||
+ * PUBLIC: int __check_lock_fn __P((char *, pid_t));
|
||||
+ */
|
||||
+
|
||||
+int __check_lock_fn(fn, pid)
|
||||
@ -60,7 +82,7 @@ diff -up db-5.3.28/src/os/os_flock.c.pthreads db-5.3.28/src/os/os_flock.c
|
||||
+ FILE* fp;
|
||||
+ char buffer[PATH_MAX];
|
||||
+ char *token;
|
||||
+ int i, fd, inode;
|
||||
+ int i, inode;
|
||||
+ struct stat st;
|
||||
+ pid_t lpid = 0;
|
||||
+
|
||||
@ -72,8 +94,10 @@ diff -up db-5.3.28/src/os/os_flock.c.pthreads db-5.3.28/src/os/os_flock.c
|
||||
+ return -1;
|
||||
+
|
||||
+ /* Get the file's inode */
|
||||
+ if (stat(fn, &st))
|
||||
+ if (stat(fn, &st)) {
|
||||
+ fclose(fp);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ while (fgets(buffer, sizeof(buffer), fp))
|
||||
+ for (token = strtok(buffer, " "), i = 0; token; token = strtok(NULL, " "), i++) {
|
||||
|
@ -1,6 +1,28 @@
|
||||
diff -up db-5.3.28/src/dbinc_auto/int_def.in.rpmlock db-5.3.28/src/dbinc_auto/int_def.in
|
||||
--- db-5.3.28/src/dbinc_auto/int_def.in.rpmlock 2017-06-26 15:09:17.883356255 +0200
|
||||
+++ db-5.3.28/src/dbinc_auto/int_def.in 2017-06-26 15:09:27.421170401 +0200
|
||||
@@ -1573,6 +1573,7 @@
|
||||
#define __os_posix_err __os_posix_err@DB_VERSION_UNIQUE_NAME@
|
||||
#define __os_fileid __os_fileid@DB_VERSION_UNIQUE_NAME@
|
||||
#define __check_lock_fn __check_lock_fn@DB_VERSION_UNIQUE_NAME@
|
||||
+#define __rpm_lock_free __rpm_lock_free@DB_VERSION_UNIQUE_NAME@
|
||||
#define __os_fdlock __os_fdlock@DB_VERSION_UNIQUE_NAME@
|
||||
#define __os_fsync __os_fsync@DB_VERSION_UNIQUE_NAME@
|
||||
#define __os_getenv __os_getenv@DB_VERSION_UNIQUE_NAME@
|
||||
diff -up db-5.3.28/src/dbinc_auto/os_ext.h.rpmlock db-5.3.28/src/dbinc_auto/os_ext.h
|
||||
--- db-5.3.28/src/dbinc_auto/os_ext.h.rpmlock 2017-06-26 15:09:21.940277203 +0200
|
||||
+++ db-5.3.28/src/dbinc_auto/os_ext.h 2017-06-26 15:09:27.354171707 +0200
|
||||
@@ -42,6 +42,7 @@ char *__os_strerror __P((int, char *, si
|
||||
int __os_posix_err __P((int));
|
||||
int __os_fileid __P((ENV *, const char *, int, u_int8_t *));
|
||||
int __check_lock_fn __P((char *, pid_t));
|
||||
+int __rpm_lock_free __P((ENV *));
|
||||
int __os_fdlock __P((ENV *, DB_FH *, off_t, db_lockmode_t, int));
|
||||
int __os_fsync __P((ENV *, DB_FH *));
|
||||
int __os_getenv __P((ENV *, const char *, char **, size_t));
|
||||
diff -up db-5.3.28/src/env/env_region.c.rpmlock db-5.3.28/src/env/env_region.c
|
||||
--- db-5.3.28/src/env/env_region.c.rpmlock 2017-06-19 09:53:42.727715374 +0200
|
||||
+++ db-5.3.28/src/env/env_region.c 2017-06-19 09:55:28.195688220 +0200
|
||||
--- db-5.3.28/src/env/env_region.c.rpmlock 2017-06-26 15:09:12.479461558 +0200
|
||||
+++ db-5.3.28/src/env/env_region.c 2017-06-26 15:09:12.481461519 +0200
|
||||
@@ -291,18 +291,23 @@ user_map_functions:
|
||||
if (create_ok &&
|
||||
ret == DB_OLD_VERSION &&
|
||||
@ -37,15 +59,16 @@ diff -up db-5.3.28/src/env/env_region.c.rpmlock db-5.3.28/src/env/env_region.c
|
||||
|
||||
if (renv->majver != DB_VERSION_MAJOR ||
|
||||
diff -up db-5.3.28/src/os/os_flock.c.rpmlock db-5.3.28/src/os/os_flock.c
|
||||
--- db-5.3.28/src/os/os_flock.c.rpmlock 2017-06-19 09:52:49.418740004 +0200
|
||||
+++ db-5.3.28/src/os/os_flock.c 2017-06-19 09:53:16.428220866 +0200
|
||||
@@ -70,6 +70,34 @@ int __check_lock_fn(fn, pid)
|
||||
--- db-5.3.28/src/os/os_flock.c.rpmlock 2017-06-26 15:09:12.480461538 +0200
|
||||
+++ db-5.3.28/src/os/os_flock.c 2017-06-26 15:09:12.481461519 +0200
|
||||
@@ -79,6 +79,35 @@ int __check_lock_fn(fn, pid)
|
||||
}
|
||||
|
||||
/*
|
||||
+ * __rpm_lock_free --
|
||||
+ * Try to look at a lock used by rpm to see if libdb is being
|
||||
+ * updated and it is safe to access its environment files.
|
||||
+ * PUBLIC: int __rpm_lock_free __P((ENV *));
|
||||
+ */
|
||||
+
|
||||
+#define RPM_PATH SHAREDSTATEDIR "/rpm"
|
||||
|
@ -4,7 +4,7 @@
|
||||
Summary: The Berkeley DB database library for C
|
||||
Name: libdb
|
||||
Version: 5.3.28
|
||||
Release: 23%{?dist}
|
||||
Release: 24%{?dist}
|
||||
Source0: http://download.oracle.com/berkeley-db/db-%{version}.tar.gz
|
||||
Source1: http://download.oracle.com/berkeley-db/db.1.85.tar.gz
|
||||
# For mt19937db.c
|
||||
@ -446,6 +446,9 @@ rm -rf ${RPM_BUILD_ROOT}
|
||||
%{_libdir}/libdb_java.so
|
||||
|
||||
%changelog
|
||||
* Mon Jun 26 2017 Petr Kubat <pkubat@redhat.com> - 5.3.28-24
|
||||
- Fix some defects found by covscan
|
||||
|
||||
* Mon Jun 26 2017 Petr Kubat <pkubat@redhat.com> - 5.3.28-23
|
||||
- Try looking at env lock via /proc/locks during env_attach (#1460003)
|
||||
- Check rpm's transaction lock via /proc/locks
|
||||
|
Loading…
Reference in New Issue
Block a user