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
fa0c637c
Commit
fa0c637c
authored
May 25, 2016
by
Hisham
Browse files
Silence warnings about seteuid return value.
Closes #483.
parent
b7ac4166
Changes
4
Hide whitespace changes
Inline
Side-by-side
EnvScreen.c
View file @
fa0c637c
...
@@ -49,9 +49,9 @@ void EnvScreen_scan(InfoScreen* this) {
...
@@ -49,9 +49,9 @@ void EnvScreen_scan(InfoScreen* this) {
Panel_prune
(
panel
);
Panel_prune
(
panel
);
uid_t
euid
=
geteuid
();
uid_t
euid
=
geteuid
();
seteuid
(
getuid
());
(
void
)
seteuid
(
getuid
());
char
*
env
=
Platform_getProcessEnv
(
this
->
process
->
pid
);
char
*
env
=
Platform_getProcessEnv
(
this
->
process
->
pid
);
seteuid
(
euid
);
(
void
)
seteuid
(
euid
);
if
(
env
)
{
if
(
env
)
{
for
(
char
*
p
=
env
;
*
p
;
p
=
strrchr
(
p
,
0
)
+
1
)
for
(
char
*
p
=
env
;
*
p
;
p
=
strrchr
(
p
,
0
)
+
1
)
InfoScreen_addLine
(
this
,
p
);
InfoScreen_addLine
(
this
,
p
);
...
...
Process.c
View file @
fa0c637c
...
@@ -518,10 +518,10 @@ void Process_toggleTag(Process* this) {
...
@@ -518,10 +518,10 @@ void Process_toggleTag(Process* this) {
bool
Process_setPriority
(
Process
*
this
,
int
priority
)
{
bool
Process_setPriority
(
Process
*
this
,
int
priority
)
{
uid_t
euid
=
geteuid
();
uid_t
euid
=
geteuid
();
seteuid
(
getuid
());
(
void
)
seteuid
(
getuid
());
int
old_prio
=
getpriority
(
PRIO_PROCESS
,
this
->
pid
);
int
old_prio
=
getpriority
(
PRIO_PROCESS
,
this
->
pid
);
int
err
=
setpriority
(
PRIO_PROCESS
,
this
->
pid
,
priority
);
int
err
=
setpriority
(
PRIO_PROCESS
,
this
->
pid
,
priority
);
seteuid
(
euid
);
(
void
)
seteuid
(
euid
);
if
(
err
==
0
&&
old_prio
!=
getpriority
(
PRIO_PROCESS
,
this
->
pid
))
{
if
(
err
==
0
&&
old_prio
!=
getpriority
(
PRIO_PROCESS
,
this
->
pid
))
{
this
->
nice
=
priority
;
this
->
nice
=
priority
;
}
}
...
@@ -534,9 +534,9 @@ bool Process_changePriorityBy(Process* this, size_t delta) {
...
@@ -534,9 +534,9 @@ bool Process_changePriorityBy(Process* this, size_t delta) {
void
Process_sendSignal
(
Process
*
this
,
size_t
sgn
)
{
void
Process_sendSignal
(
Process
*
this
,
size_t
sgn
)
{
uid_t
euid
=
geteuid
();
uid_t
euid
=
geteuid
();
seteuid
(
getuid
());
(
void
)
seteuid
(
getuid
());
kill
(
this
->
pid
,
(
int
)
sgn
);
kill
(
this
->
pid
,
(
int
)
sgn
);
seteuid
(
euid
);
(
void
)
seteuid
(
euid
);
}
}
long
Process_pidCompare
(
const
void
*
v1
,
const
void
*
v2
)
{
long
Process_pidCompare
(
const
void
*
v1
,
const
void
*
v2
)
{
...
...
Settings.c
View file @
fa0c637c
...
@@ -167,9 +167,9 @@ static bool Settings_read(Settings* this, const char* fileName) {
...
@@ -167,9 +167,9 @@ static bool Settings_read(Settings* this, const char* fileName) {
FILE
*
fd
;
FILE
*
fd
;
uid_t
euid
=
geteuid
();
uid_t
euid
=
geteuid
();
seteuid
(
getuid
());
(
void
)
seteuid
(
getuid
());
fd
=
fopen
(
fileName
,
"r"
);
fd
=
fopen
(
fileName
,
"r"
);
seteuid
(
euid
);
(
void
)
seteuid
(
euid
);
if
(
!
fd
)
if
(
!
fd
)
return
false
;
return
false
;
...
@@ -277,9 +277,9 @@ bool Settings_write(Settings* this) {
...
@@ -277,9 +277,9 @@ bool Settings_write(Settings* this) {
FILE
*
fd
;
FILE
*
fd
;
uid_t
euid
=
geteuid
();
uid_t
euid
=
geteuid
();
seteuid
(
getuid
());
(
void
)
seteuid
(
getuid
());
fd
=
fopen
(
this
->
filename
,
"w"
);
fd
=
fopen
(
this
->
filename
,
"w"
);
seteuid
(
euid
);
(
void
)
seteuid
(
euid
);
if
(
fd
==
NULL
)
{
if
(
fd
==
NULL
)
{
return
false
;
return
false
;
}
}
...
@@ -366,7 +366,7 @@ Settings* Settings_new(int cpuCount) {
...
@@ -366,7 +366,7 @@ Settings* Settings_new(int cpuCount) {
}
}
legacyDotfile
=
String_cat
(
home
,
"/.htoprc"
);
legacyDotfile
=
String_cat
(
home
,
"/.htoprc"
);
uid_t
euid
=
geteuid
();
uid_t
euid
=
geteuid
();
seteuid
(
getuid
());
(
void
)
seteuid
(
getuid
());
(
void
)
mkdir
(
configDir
,
0700
);
(
void
)
mkdir
(
configDir
,
0700
);
(
void
)
mkdir
(
htopDir
,
0700
);
(
void
)
mkdir
(
htopDir
,
0700
);
free
(
htopDir
);
free
(
htopDir
);
...
@@ -379,7 +379,7 @@ Settings* Settings_new(int cpuCount) {
...
@@ -379,7 +379,7 @@ Settings* Settings_new(int cpuCount) {
free
(
legacyDotfile
);
free
(
legacyDotfile
);
legacyDotfile
=
NULL
;
legacyDotfile
=
NULL
;
}
}
seteuid
(
euid
);
(
void
)
seteuid
(
euid
);
}
}
this
->
colorScheme
=
0
;
this
->
colorScheme
=
0
;
this
->
changed
=
false
;
this
->
changed
=
false
;
...
...
TraceScreen.c
View file @
fa0c637c
...
@@ -95,7 +95,7 @@ bool TraceScreen_forkTracer(TraceScreen* this) {
...
@@ -95,7 +95,7 @@ bool TraceScreen_forkTracer(TraceScreen* this) {
this
->
child
=
fork
();
this
->
child
=
fork
();
if
(
this
->
child
==
-
1
)
return
false
;
if
(
this
->
child
==
-
1
)
return
false
;
if
(
this
->
child
==
0
)
{
if
(
this
->
child
==
0
)
{
seteuid
(
getuid
());
(
void
)
seteuid
(
getuid
());
dup2
(
this
->
fdpair
[
1
],
STDERR_FILENO
);
dup2
(
this
->
fdpair
[
1
],
STDERR_FILENO
);
int
ok
=
fcntl
(
this
->
fdpair
[
1
],
F_SETFL
,
O_NONBLOCK
);
int
ok
=
fcntl
(
this
->
fdpair
[
1
],
F_SETFL
,
O_NONBLOCK
);
if
(
ok
!=
-
1
)
{
if
(
ok
!=
-
1
)
{
...
...
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