diff --git a/src/ChangeLog b/src/ChangeLog index 592ac4eb8..62f5bf07b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +Wed Feb 3 23:55:54 1999 Norbert Warmuth + + * 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 * setup.c: save we_can_afford_the_speed diff --git a/src/widget.c b/src/widget.c index cf0b040a8..ad89635e2 100644 --- a/src/widget.c +++ b/src/widget.c @@ -28,6 +28,10 @@ #include #include #include +#include +#include +#include +#include #include "tty.h" #include #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;