SHA256
1
0
forked from pool/readline
readline/readline-6.3-rltrace.patch

44 lines
968 B
Diff

Even if used only by developers to debug readline library do not open
temporary files from public location without O_EXCL (bcn#868822).
---
lib/readline/util.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
--- lib/readline/util.c
+++ lib/readline/util.c 2014-04-17 10:29:43.157274616 +0000
@@ -504,10 +504,12 @@ _rl_trace (va_alist)
if (_rl_tracefp == 0)
_rl_tropen ();
+ if (!_rl_tracefp)
+ goto out;
vfprintf (_rl_tracefp, format, args);
fprintf (_rl_tracefp, "\n");
fflush (_rl_tracefp);
-
+out:
va_end (args);
}
@@ -527,7 +529,7 @@ _rl_tropen ()
#endif
sprintf (fnbuf, "%s/rltrace.%ld", x, (long)getpid());
unlink(fnbuf);
- _rl_tracefp = fopen (fnbuf, "w+");
+ _rl_tracefp = fopen (fnbuf, "w+xe");
return _rl_tracefp != 0;
}
@@ -535,8 +537,8 @@ int
_rl_trclose ()
{
int r;
-
- r = fclose (_rl_tracefp);
+ if (_rl_tracefp)
+ r = fclose (_rl_tracefp);
_rl_tracefp = 0;
return r;
}