X-Git-Url: http://git.pld-linux.org/?p=packages%2Frpm.git;a=blobdiff_plain;f=rpm-scripts-closefds.patch;h=5a9f7871c0cc8e2ed94212d9e5e08052fecdc5a1;hp=da005dad6709ec3b4ced38d31e5c4278d39d157d;hb=f0190526e611252ad14478726ad4de2c407200cc;hpb=3dbbfd100a81d4f3c6034902b9ae2ba45b68de4b diff --git a/rpm-scripts-closefds.patch b/rpm-scripts-closefds.patch index da005da..5a9f787 100644 --- a/rpm-scripts-closefds.patch +++ b/rpm-scripts-closefds.patch @@ -1,30 +1,19 @@ -diff -Nur rpm-4.0.2.orig/lib/rpminstall.c rpm-4.0.2/lib/rpminstall.c ---- rpm-4.0.2.orig/lib/rpminstall.c Sat Feb 10 15:07:16 2001 -+++ rpm-4.0.2/lib/rpminstall.c Sun Sep 9 00:33:52 2001 -@@ -87,6 +87,13 @@ - case RPMCALLBACK_INST_OPEN_FILE: - fd = Fopen(filename, "r.ufdio"); - fd = fdLink(fd, "persist (showProgress)"); -+ { -+ int oldfl=Fcntl(fd, F_GETFD, 0); -+ if(oldfl >= 0) { -+ oldfl |= FD_CLOEXEC; /* scripts shouldn't inherit rpm file descriptor */ -+ Fcntl(fd, F_SETFD, oldfl); -+ } -+ } - return fd; - - case RPMCALLBACK_INST_CLOSE_FILE: -diff -Nur rpm-4.0.2.orig/lib/uninstall.c rpm-4.0.2/lib/uninstall.c ---- rpm-4.0.2.orig/lib/uninstall.c Mon Jan 22 16:59:13 2001 -+++ rpm-4.0.2/lib/uninstall.c Sat Sep 8 23:58:22 2001 -@@ -388,6 +388,9 @@ - if (Fileno(ts->scriptFd) > STDERR_FILENO) { - Fclose (ts->scriptFd); +--- rpm-4.1/lib/rpminstall.c.wiget Mon Sep 16 21:06:08 2002 ++++ rpm-4.1/lib/rpminstall.c Thu Sep 19 00:03:36 2002 +@@ -126,8 +126,15 @@ + xx = Fclose(fd); + fd = NULL; } +- } else + } else { -+ if (Fileno(out) > STDERR_FILENO) -+ Fclose (out); - } ++ long oldfl; + fd = fdLink(fd, "persist (showProgress)"); ++ oldfl=Fcntl(fd, F_GETFD, 0); ++ if(oldfl >= 0) { ++ oldfl |= FD_CLOEXEC; /* scripts shouldn't inherit rpm file descriptor */ ++ Fcntl(fd, F_SETFD, (void*)oldfl); ++ } ++ } - { const char *ipath = rpmExpand("PATH=%{_install_script_path}", NULL); + #if defined(POSIX_FADV_WILLNEED) + (void) Fadvise(fd, 0, 0, POSIX_FADV_WILLNEED);