Skip to content

Commit

Permalink
add root check
Browse files Browse the repository at this point in the history
Signed-off-by: ston <[email protected]>
  • Loading branch information
st0nie committed Apr 9, 2024
1 parent 15f5a50 commit adfec4f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,8 @@ dkms.conf

build/
dist/

# Legiond
extra/service/legiond/legiond
extra/service/legiond/legiond-ctl
.ccls-cache
5 changes: 5 additions & 0 deletions extra/service/legiond/legiond-ctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

int main(int argc, char *argv[])
{
if (getuid() != 0){
printf("require root privileges\n");
exit(3);
}

if (access(socket_path, F_OK) == -1) {
printf("socket not found\n");
exit(1);
Expand Down

0 comments on commit adfec4f

Please sign in to comment.