27 lines
668 B
Diff
27 lines
668 B
Diff
|
|
From 68c1a3a7b8277cb225ab221c3a6a4f239b81c9e1 Mon Sep 17 00:00:00 2001
|
||
|
|
From: shenyangyang <shenyangyang4@huawei.com>
|
||
|
|
Date: Mon, 2 Sep 2019 22:30:32 -0400
|
||
|
|
Subject: [PATCH] bugfix-Forbidden-non-root-user-to-clear-history
|
||
|
|
|
||
|
|
---
|
||
|
|
lib/readline/history.c | 4 ++++
|
||
|
|
1 file changed, 4 insertions(+)
|
||
|
|
|
||
|
|
diff --git a/lib/readline/history.c b/lib/readline/history.c
|
||
|
|
index 67158b1..8bc6a00 100644
|
||
|
|
--- a/lib/readline/history.c
|
||
|
|
+++ b/lib/readline/history.c
|
||
|
|
@@ -594,6 +594,10 @@ void
|
||
|
|
clear_history (void)
|
||
|
|
{
|
||
|
|
register int i;
|
||
|
|
+ uid_t uid = getuid();
|
||
|
|
+
|
||
|
|
+ if (uid)
|
||
|
|
+ return;
|
||
|
|
|
||
|
|
/* This loses because we cannot free the data. */
|
||
|
|
for (i = 0; i < history_length; i++)
|
||
|
|
--
|
||
|
|
2.19.1
|