packages: nss_db/nss_db.spec, nss_db/nss_db-makedb-atomic.patch (NEW) - add...
glen
glen at pld-linux.org
Mon Feb 22 18:36:18 CET 2010
Author: glen Date: Mon Feb 22 17:36:18 2010 GMT
Module: packages Tag: HEAD
---- Log message:
- add -makedb-atomic.patch from fc/centos
---- Files affected:
packages/nss_db:
nss_db.spec (1.39 -> 1.40) , nss_db-makedb-atomic.patch (NONE -> 1.1) (NEW)
---- Diffs:
================================================================
Index: packages/nss_db/nss_db.spec
diff -u packages/nss_db/nss_db.spec:1.39 packages/nss_db/nss_db.spec:1.40
--- packages/nss_db/nss_db.spec:1.39 Mon Feb 22 18:13:23 2010
+++ packages/nss_db/nss_db.spec Mon Feb 22 18:36:13 2010
@@ -28,6 +28,7 @@
Patch7: %{name}-uniqdb.patch
Patch8: %{name}-initialize.patch
Patch9: %{name}-selinux.patch
+Patch10: %{name}-makedb-atomic.patch
Patch101: http://www.oracle.com/technology/products/berkeley-db/db/update/4.6.21/patch.4.6.21.1
Patch102: http://www.oracle.com/technology/products/berkeley-db/db/update/4.6.21/patch.4.6.21.2
Patch103: http://www.oracle.com/technology/products/berkeley-db/db/update/4.6.21/patch.4.6.21.3
@@ -66,6 +67,7 @@
%patch7 -p1
%patch8 -p1
%patch9 -p1
+%patch10 -p1
mkdir db-build
cd db-%{db_version}
@@ -182,6 +184,9 @@
All persons listed below can be reached at <cvs_login>@pld-linux.org
$Log$
+Revision 1.40 2010/02/22 17:36:13 glen
+- add -makedb-atomic.patch from fc/centos
+
Revision 1.39 2010/02/22 17:13:23 glen
- update berkdb to 4.6.21.4
- more specific license
================================================================
Index: packages/nss_db/nss_db-makedb-atomic.patch
diff -u /dev/null packages/nss_db/nss_db-makedb-atomic.patch:1.1
--- /dev/null Mon Feb 22 18:36:18 2010
+++ packages/nss_db/nss_db-makedb-atomic.patch Mon Feb 22 18:36:13 2010
@@ -0,0 +1,57 @@
+from fc cvs:
+
+revision 1.1
+date: 2008/08/07 16:51:58; author: nalin; state: Exp;
+- create and populate new db files, moving them in place afterward (patch
+ from Kelsey Cummings, CentOS #1987)
+
+--- nss_db-2.2/src/makedb.c 2008-08-04 14:21:06.000000000 -0700
++++ nss_db-2.2/src/makedb.c 2008-08-04 14:24:08.000000000 -0700
+@@ -31,6 +31,7 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <sys/stat.h>
++#include <unistd.h>
+
+ #ifdef SELINUX
+ #include <selinux/selinux.h>
+@@ -110,6 +111,7 @@
+ main (int argc, char *argv[])
+ {
+ const char *input_name;
++ char *output_name_temp;
+ FILE *input_file;
+ DB *db_file;
+ int status;
+@@ -184,10 +186,17 @@
+ mode = st.st_mode & ACCESSPERMS;
+ }
+
++ /* Get name for tempfile using output_name and pid */
++ status = asprintf(&output_name_temp,"%s.%s.%d",output_name,"tmp",getpid());
++ if ( status < 0 )
++ {
++ error (EXIT_FAILURE, 0, gettext ("cannot generate temp file name"));
++ }
++
+ /* Open output file. This must not be standard output so we don't
+ handle "-" and "/dev/stdout" special. */
+ set_file_creation_context (output_name, mode);
+- status = db_open (output_name, DB_BTREE, DB_CREATE | DB_TRUNCATE, mode,
++ status = db_open (output_name_temp, DB_BTREE, DB_CREATE | DB_TRUNCATE, mode,
+ NULL, NULL, &db_file);
+ set_file_creation_context (NULL, 0);
+ if (status)
+@@ -203,6 +212,12 @@
+ fclose (input_file);
+ db_file->close (db_file, 0);
+
++ /* all done, move temp file over real file */
++ status = rename(output_name_temp,output_name);
++ if ( status < 0 )
++ error (EXIT_FAILURE, errno, gettext ("cannot rename `%s' to `%s'"),
++ output_name_temp, output_name);
++
+ return status;
+ }
+
================================================================
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/nss_db/nss_db.spec?r1=1.39&r2=1.40&f=u
More information about the pld-cvs-commit
mailing list