Wed Feb 3 23:55:54 1999 Norbert Warmuth <nwarmuth@privat.circular.de>

* widget.c (history_put): set the access rights correctly when
the history file is created initially. Don't save the history
if we can't set the access rights.
This commit is contained in:
Norbert Warmuth 1999-02-04 00:11:07 +00:00
parent 7fe4887f79
commit 30352f64c3
2 changed files with 15 additions and 2 deletions

View File

@ -1,3 +1,9 @@
Wed Feb 3 23:55:54 1999 Norbert Warmuth <nwarmuth@privat.circular.de>
* widget.c (history_put): set the access rights correctly when
the history file is created initially. Don't save the history
if we can't set the access rights.
1999-02-01 Jonathan Blandford <jrb@redhat.com>
* setup.c: save we_can_afford_the_speed

View File

@ -28,6 +28,10 @@
#include <config.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "tty.h"
#include <ctype.h>
#include "global.h"
@ -40,7 +44,6 @@
#include "key.h" /* XCTRL and ALT macros */
#include "x.h"
#include "profile.h" /* for history loading and saving */
#include "../vfs/vfs.h"
#ifndef HAVE_X
# define x_create_button(a,b,c) 1
@ -944,8 +947,12 @@ void history_put (char *input_name, Hist *h)
profile = concat_dir_and_file (home_dir, HISTORY_FILE_NAME);
if ((i = open (profile, O_CREAT | O_EXCL, S_IRUSR | S_IWUSR)) != -1)
close (i);
/* Just in case I forgot to strip passwords somewhere -- Norbert */
mc_chmod (profile, S_IRUSR | S_IWUSR);
if (chmod (profile, S_IRUSR | S_IWUSR) == -1 && errno != ENOENT)
return;
while (h->next) /* go to end of list */
h = h->next;