eliminate unnecessary inotify events on upload via file protocol (#844385)

This commit is contained in:
Kamil Dudka 2012-08-01 09:47:27 +02:00
parent 347af7bb2d
commit 08a21a3079
2 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,34 @@
From e693b8e6591366ef2c077ba90fe0315a8a0b00c5 Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Mon, 30 Jul 2012 14:20:07 +0200
Subject: [PATCH] file: use fdopen() for uploaded files if available
It eliminates noisy events when using inotify and fixes a TOCTOU issue.
Bug: https://bugzilla.redhat.com/844385
[upstream commit 1f8518c5d9aaa369dae85620973f9b5c1add3277]
---
lib/file.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/lib/file.c b/lib/file.c
index 4447c73..1025022 100644
--- a/lib/file.c
+++ b/lib/file.c
@@ -351,8 +351,12 @@ static CURLcode file_upload(struct connectdata *conn)
failf(data, "Can't open %s for writing", file->path);
return CURLE_WRITE_ERROR;
}
+#ifdef HAVE_FDOPEN
+ fp = fdopen(fd, "wb");
+#else
close(fd);
fp = fopen(file->path, "wb");
+#endif
}
if(!fp) {
--
1.7.1

View File

@ -23,6 +23,9 @@ Patch4: 0004-curl-7.24.0-72f4b534.patch
# print reason phrase from HTTP status line on error (#676596)
Patch5: 0005-curl-7.24.0-d317ca50.patch
# eliminate unnecessary inotify events on upload via file protocol (#844385)
Patch6: 0006-curl-7.24.0-1f8518c5.patch
# patch making libcurl multilib ready
Patch101: 0101-curl-7.21.1-multilib.patch
@ -127,6 +130,7 @@ done
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
# Fedora patches
%patch101 -p1
@ -243,6 +247,7 @@ rm -rf $RPM_BUILD_ROOT
* Wed Aug 01 2012 Kamil Dudka <kdudka@redhat.com> 7.24.0-5
- use human-readable error messages provided by NSS (upstream commit 72f4b534)
- print reason phrase from HTTP status line on error (#676596)
- eliminate unnecessary inotify events on upload via file protocol (#844385)
* Sat Jun 09 2012 Kamil Dudka <kdudka@redhat.com> 7.24.0-4
- fix duplicated SSL handshake with multi interface and proxy (#788526)