Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
htop
Commits
823bdbae
Commit
823bdbae
authored
Apr 22, 2014
by
Hisham Muhammad
Browse files
safer code, check result of lstat
parent
1afbc190
Changes
1
Hide whitespace changes
Inline
Side-by-side
Settings.c
View file @
823bdbae
...
...
@@ -243,12 +243,14 @@ Settings* Settings_new(ProcessList* pl, Header* header, int cpuCount) {
htopDir
=
String_cat
(
home
,
"/.config/htop"
);
}
legacyDotfile
=
String_cat
(
home
,
"/.htoprc"
);
mkdir
(
configDir
,
0700
);
mkdir
(
htopDir
,
0700
);
(
void
)
mkdir
(
configDir
,
0700
);
(
void
)
mkdir
(
htopDir
,
0700
);
free
(
htopDir
);
free
(
configDir
);
struct
stat
st
;
lstat
(
legacyDotfile
,
&
st
);
if
(
lstat
(
legacyDotfile
,
&
st
)
!=
0
)
{
st
.
st_mode
=
0
;
}
if
(
access
(
legacyDotfile
,
R_OK
)
!=
0
||
S_ISLNK
(
st
.
st_mode
))
{
free
(
legacyDotfile
);
legacyDotfile
=
NULL
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment