rpms/gource/F-12 gource-predictable-tmp-filename.patch, NONE, 1.1 gource.spec, 1.2, 1.3
Siddhesh Poyarekar
siddhesh at fedoraproject.org
Fri Apr 16 08:38:45 UTC 2010
Author: siddhesh
Update of /cvs/pkgs/rpms/gource/F-12
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv27338
Modified Files:
gource.spec
Added Files:
gource-predictable-tmp-filename.patch
Log Message:
BZ #582781 Randomize name for files created in /tmp
gource-predictable-tmp-filename.patch:
commitlog.cpp | 29 +++++++++++++++--------------
commitlog.h | 3 +--
2 files changed, 16 insertions(+), 16 deletions(-)
--- NEW FILE gource-predictable-tmp-filename.patch ---
>From 5aa2c8adfbe0ec3e5d802bfae8e5572562d911c7 Mon Sep 17 00:00:00 2001
From: Andrew Caudwell <acaudwell at gmail.com>
Date: Thu, 15 Apr 2010 23:26:19 +0000
Subject: [PATCH] Create temp file using mkstemp.
---
src/commitlog.cpp | 29 +++++++++++++++--------------
src/commitlog.h | 2 +-
2 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/src/commitlog.cpp b/src/commitlog.cpp
index 689a100..87171d5 100644
--- a/src/commitlog.cpp
+++ b/src/commitlog.cpp
@@ -206,34 +206,35 @@ bool RCommitLog::isFinished() {
return false;
}
-std::string RCommitLog::createTempLog() {
- //create temp file
- char logfile_buff[1024];
+//create temp file
+void RCommitLog::createTempLog() {
+
+ std::string tempdir;
#ifdef _WIN32
DWORD tmplen = GetTempPath(0, "");
- if(tmplen == 0) return 0;
+ if(tmplen == 0) return;
std::vector<TCHAR> temp(tmplen+1);
tmplen = GetTempPath(static_cast<DWORD>(temp.size()), &temp[0]);
- if(tmplen == 0 || tmplen >= temp.size()) return 0;
-
- std::string temp_file_path(temp.begin(),
- temp.begin() + static_cast<std::size_t>(tmplen));
+ if(tmplen == 0 || tmplen >= temp.size()) return;
- temp_file_path += "gource.tmp";
+ std::string tempdir = std::string(temp.begin(), temp.begin() + static_cast<std::size_t>(tmplen));
+ tempdir += "\\";
- sprintf(logfile_buff, "%s", temp_file_path.c_str());
#else
- uid_t myuid = getuid();
- sprintf(logfile_buff, "/tmp/gource-%d.tmp", myuid);
+ tempdir = "/tmp/";
#endif
- temp_file = std::string(logfile_buff);
- return temp_file;
+ char tmplate[1024];
+ snprintf(tmplate, 1024, "%sgource-XXXXXX", tempdir.c_str());
+
+ if(mkstemp(tmplate) < 0) return;
+
+ temp_file = std::string(tmplate);
}
// RCommitFile
diff --git a/src/commitlog.h b/src/commitlog.h
index 1867396..5ff8da2 100644
--- a/src/commitlog.h
+++ b/src/commitlog.h
@@ -77,7 +77,7 @@ protected:
bool checkFirstChar(int firstChar, std::istream& stream);
- std::string createTempLog();
+ void createTempLog();
bool getNextLine(std::string& line);
--
1.6.5
Index: gource.spec
===================================================================
RCS file: /cvs/pkgs/rpms/gource/F-12/gource.spec,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -p -r1.2 -r1.3
--- gource.spec 28 Feb 2010 12:45:06 -0000 1.2
+++ gource.spec 16 Apr 2010 08:38:45 -0000 1.3
@@ -3,7 +3,7 @@
Summary: Software version control visualization
Name: gource
Version: 0.24
-Release: 2%{?dist}
+Release: 3%{?dist}
URL: http://gource.googlecode.com/
Source: http://gource.googlecode.com/files/%{name}-%{version}.tar.gz
@@ -27,6 +27,9 @@ Requires: gnu-free-sans-fonts
# https://bugzilla.redhat.com/show_bug.cgi?id=567559
Patch0: gource-ppm-software-flip.patch
+# https://bugzilla.redhat.com/show_bug.cgi?id=582781
+Patch1: gource-predictable-tmp-filename.patch
+
%description
OpenGL-based 3D visualisation tool for source control repositories.
@@ -40,6 +43,7 @@ files and directories.
sed -i.cp -e 's|cp |cp -p |' Makefile.in
%patch0 -p1 -b .ppm-software-flip
+%patch1 -p1 -b .predictable-tmp-filename
%build
%configure --enable-ttf-font-dir=%{_datadir}/fonts/gnu-free/
@@ -64,6 +68,9 @@ rm -rf %{buildroot}
%{_datadir}/gource/*
%changelog
+* Fri Apr 16 2010 Siddhesh Poyarekar <spoyarek at redhat.com> - 0.24-3
+- BZ #582781 Randomize name for files created in /tmp
+
* Sun Feb 28 2010 Siddhesh Poyarekar <spoyarek at redhat.com> - 0.24-2
- BZ #567559: Flip images in software for PPM output since hardware flipping
fails on some video cards
More information about the scm-commits
mailing list