diff --git a/libedit-ocloexec.patch b/libedit-ocloexec.patch new file mode 100644 index 0000000..b3b58b6 --- /dev/null +++ b/libedit-ocloexec.patch @@ -0,0 +1,79 @@ +Index: libedit-20110802-3.0/src/readline.c +=================================================================== +--- libedit-20110802-3.0.orig/src/readline.c ++++ libedit-20110802-3.0/src/readline.c +@@ -1175,15 +1175,15 @@ history_truncate_file (const char *filen + + if (filename == NULL && (filename = _default_history_file()) == NULL) + return errno; +- if ((fp = fopen(filename, "r+")) == NULL) ++ if ((fp = fopen(filename, "r+e")) == NULL) + return errno; + strcpy(template, _history_tmp_template); +- if ((fd = mkstemp(template)) == -1) { ++ if ((fd = mkostemp(template, O_CLOEXEC)) == -1) { + ret = errno; + goto out1; + } + +- if ((tp = fdopen(fd, "r+")) == NULL) { ++ if ((tp = fdopen(fd, "r+e")) == NULL) { + close(fd); + ret = errno; + goto out2; +Index: libedit-20110802-3.0/src/vi.c +=================================================================== +--- libedit-20110802-3.0.orig/src/vi.c ++++ libedit-20110802-3.0/src/vi.c +@@ -37,6 +37,7 @@ + #include + #include + #include ++#include + + #if !defined(lint) && !defined(SCCSID) + #if 0 +@@ -1015,7 +1016,7 @@ vi_histedit(EditLine *el, Int c __attrib + return CC_ERROR; + } + +- fd = mkstemp(tempfile); ++ fd = mkostemp(tempfile, O_CLOEXEC); + if (fd < 0) + return CC_ERROR; + len = (size_t)(el->el_line.lastchar - el->el_line.buffer); +Index: libedit-20110802-3.0/src/el.c +=================================================================== +--- libedit-20110802-3.0.orig/src/el.c ++++ libedit-20110802-3.0/src/el.c +@@ -539,7 +539,7 @@ el_source(EditLine *el, const char *fnam + #endif + } + if (fp == NULL) +- fp = fopen(fname, "r"); ++ fp = fopen(fname, "re"); + if (fp == NULL) { + el_free(path); + return -1; +Index: libedit-20110802-3.0/src/history.c +=================================================================== +--- libedit-20110802-3.0.orig/src/history.c ++++ libedit-20110802-3.0/src/history.c +@@ -741,7 +741,7 @@ history_load(TYPE(History) *h, const cha + static ct_buffer_t conv; + #endif + +- if ((fp = fopen(fname, "r")) == NULL) ++ if ((fp = fopen(fname, "re")) == NULL) + return i; + + if ((line = fgetln(fp, &sz)) == NULL) +@@ -802,7 +802,7 @@ history_save(TYPE(History) *h, const cha + static ct_buffer_t conv; + #endif + +- if ((fp = fopen(fname, "w")) == NULL) ++ if ((fp = fopen(fname, "we")) == NULL) + return -1; + + if (fchmod(fileno(fp), S_IRUSR|S_IWUSR) == -1) diff --git a/libedit-visibility.patch b/libedit-visibility.patch new file mode 100644 index 0000000..f87adb8 --- /dev/null +++ b/libedit-visibility.patch @@ -0,0 +1,22 @@ +Index: libedit-20110802-3.0/src/sys.h +=================================================================== +--- libedit-20110802-3.0.orig/src/sys.h ++++ libedit-20110802-3.0/src/sys.h +@@ -63,7 +63,7 @@ + #endif + + #ifndef public +-# define public /* Externally visible functions/variables */ ++# define public __attribute__ ((visibility ("default"))) /* Externally visible functions/variables */ + #endif + + #ifndef private +@@ -71,7 +71,7 @@ + #endif + + #ifndef protected +-# define protected /* Redefined from elsewhere to "static" */ ++# define protected __attribute__ ((visibility ("hidden"))) /* Redefined from elsewhere to "static" */ + /* When we want to hide everything */ + #endif + diff --git a/libedit.changes b/libedit.changes index 231b83e..249ba83 100644 --- a/libedit.changes +++ b/libedit.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Tue Mar 13 01:51:31 UTC 2012 - crrodriguez@opensuse.org + +- open all FDs with O_CLOEXEC in the library code. +- use gcc visibility by just reusing upstream macros "public" + and "protected" + ------------------------------------------------------------------- Thu Feb 23 18:56:27 UTC 2012 - crrodriguez@opensuse.org diff --git a/libedit.spec b/libedit.spec index 5f2f55a..96bc5ca 100644 --- a/libedit.spec +++ b/libedit.spec @@ -35,7 +35,8 @@ Source: %{pkg_name}-%{pkg_version}.tar.gz Source1: README.SuSE Source2: baselibs.conf Patch2: libedit-20100424-3.0-ncurses.patch -# +Patch3: libedit-ocloexec.patch +Patch4: libedit-visibility.patch Summary: Command Line Editing and History Library License: BSD-3-Clause Group: Development/Libraries/C and C++ @@ -74,10 +75,11 @@ at a terminal prompt. This package holds the development files for libedit. %prep -%setup -n %{pkg_name}-%{pkg_version} +%setup -q -n %{pkg_name}-%{pkg_version} %{__cp} %{S:1} . %patch2 - +%patch3 -p1 +%patch4 -p1 %build NOCONFIGURE=1 autoreconf -fiv %configure --disable-static --with-pic \