lineedit: fix atomic replace of history file; hush: fix $HISTFILE handling

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index 1026519..5d13904 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -1425,7 +1425,7 @@
 
 		/* write out temp file and replace hist_file atomically */
 		new_name = xasprintf("%s.%u.new", state->hist_file, (int) getpid());
-		fd = open(state->hist_file, O_WRONLY | O_CREAT | O_TRUNC, 0600);
+		fd = open(new_name, O_WRONLY | O_CREAT | O_TRUNC, 0600);
 		if (fd >= 0) {
 			FILE *fp;
 			int i;
@@ -1475,7 +1475,7 @@
 	/* i <= state->max_history */
 	state->cur_history = i;
 	state->cnt_history = i;
-# if MAX_HISTORY > 0 && ENABLE_FEATURE_EDITING_SAVEHISTORY
+# if ENABLE_FEATURE_EDITING_SAVEHISTORY
 	if ((state->flags & SAVE_HISTORY) && state->hist_file)
 		save_history(str);
 # endif