Blame SOURCES/readline-6.2-rl_trace.patch
|
|
75031d |
diff --git a/util.c b/util.c
|
|
|
75031d |
index 6c68ad8..713e637 100644
|
|
|
75031d |
--- a/util.c
|
|
|
75031d |
+++ b/util.c
|
|
|
75031d |
@@ -493,10 +493,13 @@ _rl_trace (va_alist)
|
|
|
75031d |
|
|
|
75031d |
if (_rl_tracefp == 0)
|
|
|
75031d |
_rl_tropen ();
|
|
|
75031d |
+ if (!_rl_tracefp)
|
|
|
75031d |
+ goto out;
|
|
|
75031d |
vfprintf (_rl_tracefp, format, args);
|
|
|
75031d |
fprintf (_rl_tracefp, "\n");
|
|
|
75031d |
fflush (_rl_tracefp);
|
|
|
75031d |
|
|
|
75031d |
+out:
|
|
|
75031d |
va_end (args);
|
|
|
75031d |
}
|
|
|
75031d |
|
|
|
75031d |
@@ -509,16 +512,17 @@ _rl_tropen ()
|
|
|
75031d |
fclose (_rl_tracefp);
|
|
|
75031d |
sprintf (fnbuf, "/var/tmp/rltrace.%ld", getpid());
|
|
|
75031d |
unlink(fnbuf);
|
|
|
75031d |
- _rl_tracefp = fopen (fnbuf, "w+");
|
|
|
75031d |
+ _rl_tracefp = fopen (fnbuf, "w+xe");
|
|
|
75031d |
return _rl_tracefp != 0;
|
|
|
75031d |
}
|
|
|
75031d |
|
|
|
75031d |
int
|
|
|
75031d |
_rl_trclose ()
|
|
|
75031d |
{
|
|
|
75031d |
- int r;
|
|
|
75031d |
+ int r = 0;
|
|
|
75031d |
|
|
|
75031d |
- r = fclose (_rl_tracefp);
|
|
|
75031d |
+ if (_rl_tracefp)
|
|
|
75031d |
+ r = fclose (_rl_tracefp);
|
|
|
75031d |
_rl_tracefp = 0;
|
|
|
75031d |
return r;
|
|
|
75031d |
}
|