Code cleanups

This commit is contained in:
topjohnwu
2021-01-11 02:19:10 -08:00
parent 541bb53553
commit eb21c8b42e
20 changed files with 60 additions and 81 deletions

View File

@@ -1,7 +1,6 @@
#include <sys/types.h>
#include <sys/wait.h>
#include <daemon.hpp>
#include <utils.hpp>
#include <selinux.hpp>

View File

@@ -9,13 +9,9 @@
* helper functions to handle raw input mode and terminal window resizing
*/
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <signal.h>
#include <termios.h>
#include <errno.h>
#include <pthread.h>
#include <utils.hpp>
@@ -116,7 +112,7 @@ static int stdin_is_raw = 0;
/**
* set_stdin_raw
*
* Changes stdin to raw unbuffered mode, disables echo,
* Changes stdin to raw unbuffered mode, disables echo,
* auto carriage return, etc.
*
* Return Value
@@ -180,7 +176,7 @@ int restore_stdin(void) {
static volatile bool close_sigwinch_watcher = false;
/**
* Thread process. Wait for a SIGWINCH to be received, then update
* Thread process. Wait for a SIGWINCH to be received, then update
* the terminal size.
*/
static void *watch_sigwinch(void *data) {
@@ -214,7 +210,7 @@ static void *watch_sigwinch(void *data) {
* watch_sigwinch_async
*
* After calling this function, if the application receives
* SIGWINCH, the terminal window size will be read from
* SIGWINCH, the terminal window size will be read from
* "input" and set on "output".
*
* NOTE: This function blocks SIGWINCH and spawns a thread.
@@ -228,7 +224,7 @@ static void *watch_sigwinch(void *data) {
*
* Return Value
* on failure, -1 and errno will be set. In this case, no
* thread has been spawned and SIGWINCH will not be
* thread has been spawned and SIGWINCH will not be
* blocked.
* on success, 0
*/

View File

@@ -1,26 +1,19 @@
/*
* Copyright 2017, John Wu (@topjohnwu)
* Copyright 2017 - 2021, John Wu (@topjohnwu)
* Copyright 2015, Pierre-Hugues Husson <phh@phh.me>
* Copyright 2010, Adam Shanks (@ChainsDD)
* Copyright 2008, Zinx Verituse (@zinxv)
*/
/* su.c - The main function running in the daemon
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <getopt.h>
#include <fcntl.h>
#include <pwd.h>
#include <errno.h>
#include <signal.h>
#include <sched.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <magisk.hpp>
#include <daemon.hpp>
#include <utils.hpp>
#include <flags.hpp>

View File

@@ -5,7 +5,6 @@
#include <memory>
#include <db.hpp>
#include <utils.hpp>
#define DEFAULT_SHELL "/system/bin/sh"

View File

@@ -1,20 +1,14 @@
#include <unistd.h>
#include <pthread.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include <signal.h>
#include <pwd.h>
#include <time.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/mount.h>
#include <daemon.hpp>
#include <utils.hpp>
#include <selinux.hpp>
#include <db.hpp>
#include "su.hpp"
#include "pts.hpp"