avoid deleting valid symbolic links to .htoprc

so that home directories can be used with both old and new versions of htop
(see #3496731).
This commit is contained in:
Hisham Muhammad 2012-03-05 11:12:58 +00:00
parent 571ae33bb4
commit 368cb1fe20
1 changed files with 3 additions and 1 deletions

View File

@ -239,7 +239,9 @@ Settings* Settings_new(ProcessList* pl, Header* header, int cpuCount) {
mkdir(htopDir, 0700); mkdir(htopDir, 0700);
free(htopDir); free(htopDir);
free(configDir); free(configDir);
if (access(legacyDotfile, R_OK) != 0) { struct stat st;
lstat(legacyDotfile, &st);
if (access(legacyDotfile, R_OK) != 0 || S_ISLNK(st.st_mode)) {
free(legacyDotfile); free(legacyDotfile);
legacyDotfile = NULL; legacyDotfile = NULL;
} }