summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2020-12-08 15:11:21 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-12-08 15:11:21 -0800
commitbb48056cb2baafff9f051be872c782ae43c68fe1 (patch)
treed9f0a9afedd9a05dc4f0ddc887ec435f47005868 /builtin
parentMerge branch 'rs/maintenance-run-outside-repo' (diff)
parentbuiltin/bugreport.c: use thread-safe localtime_r() (diff)
downloadtgif-bb48056cb2baafff9f051be872c782ae43c68fe1.tar.xz
Merge branch 'tb/bugreport-no-localtime'
Use of non-reentrant localtime() has been removed. * tb/bugreport-no-localtime: builtin/bugreport.c: use thread-safe localtime_r()
Diffstat (limited to 'builtin')
-rw-r--r--builtin/bugreport.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin/bugreport.c b/builtin/bugreport.c
index 3ad4b9b62e..ad3cc9c02f 100644
--- a/builtin/bugreport.c
+++ b/builtin/bugreport.c
@@ -125,6 +125,7 @@ int cmd_bugreport(int argc, const char **argv, const char *prefix)
struct strbuf report_path = STRBUF_INIT;
int report = -1;
time_t now = time(NULL);
+ struct tm tm;
char *option_output = NULL;
char *option_suffix = "%Y-%m-%d-%H%M";
const char *user_relative_path = NULL;
@@ -147,7 +148,7 @@ int cmd_bugreport(int argc, const char **argv, const char *prefix)
strbuf_complete(&report_path, '/');
strbuf_addstr(&report_path, "git-bugreport-");
- strbuf_addftime(&report_path, option_suffix, localtime(&now), 0, 0);
+ strbuf_addftime(&report_path, option_suffix, localtime_r(&now, &tm), 0, 0);
strbuf_addstr(&report_path, ".txt");
switch (safe_create_leading_directories(report_path.buf)) {