diff options
author | Fred Barclay <Fred-Barclay@users.noreply.github.com> | 2017-05-24 14:13:52 -0500 |
---|---|---|
committer | Fred Barclay <Fred-Barclay@users.noreply.github.com> | 2017-05-24 14:13:52 -0500 |
commit | 96c920e166b40bbe50f216e294f2efac154a1cb2 (patch) | |
tree | fa80a34e81863ab897f2f2b8ec4124b10d023516 /src/floader | |
parent | remove trailing whitespace from etc/ (diff) | |
download | firejail-96c920e166b40bbe50f216e294f2efac154a1cb2.tar.gz firejail-96c920e166b40bbe50f216e294f2efac154a1cb2.tar.zst firejail-96c920e166b40bbe50f216e294f2efac154a1cb2.zip |
Remove trailing whitespace from src/
Diffstat (limited to 'src/floader')
-rw-r--r-- | src/floader/README.md | 2 | ||||
-rw-r--r-- | src/floader/loader.c | 34 | ||||
-rw-r--r-- | src/floader/makefile | 2 |
3 files changed, 17 insertions, 21 deletions
diff --git a/src/floader/README.md b/src/floader/README.md index d437763a7..c1e14b2a6 100644 --- a/src/floader/README.md +++ b/src/floader/README.md | |||
@@ -5,5 +5,3 @@ READ ME | |||
5 | * Add comma separated process names to ~/.loader.conf | 5 | * Add comma separated process names to ~/.loader.conf |
6 | * export LD_PRELOAD=<path>./loader.so (ideally to .bashrc) | 6 | * export LD_PRELOAD=<path>./loader.so (ideally to .bashrc) |
7 | * Run any application within shell | 7 | * Run any application within shell |
8 | |||
9 | |||
diff --git a/src/floader/loader.c b/src/floader/loader.c index 0970794e9..6b9f92f18 100644 --- a/src/floader/loader.c +++ b/src/floader/loader.c | |||
@@ -1,13 +1,13 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2017 Madura A. (madura.x86@gmail.com) | 2 | * Copyright (C) 2017 Madura A. (madura.x86@gmail.com) |
3 | * | 3 | * |
4 | */ | 4 | */ |
5 | #include <sys/types.h> | 5 | #include <sys/types.h> |
6 | #include <sys/stat.h> | 6 | #include <sys/stat.h> |
7 | #include <sys/mman.h> | 7 | #include <sys/mman.h> |
8 | #include <fcntl.h> | 8 | #include <fcntl.h> |
9 | #include <unistd.h> | 9 | #include <unistd.h> |
10 | 10 | ||
11 | #include <string.h> | 11 | #include <string.h> |
12 | #include <stdio.h> | 12 | #include <stdio.h> |
13 | #include <stdlib.h> | 13 | #include <stdlib.h> |
@@ -35,7 +35,7 @@ void remove_trailing_spaces(char *str) | |||
35 | { | 35 | { |
36 | str++; | 36 | str++; |
37 | } | 37 | } |
38 | 38 | ||
39 | while (*str != '\0') | 39 | while (*str != '\0') |
40 | { | 40 | { |
41 | *str = '\0'; | 41 | *str = '\0'; |
@@ -70,7 +70,7 @@ void make_args() | |||
70 | { | 70 | { |
71 | if (cmdline[cI] == '\0') | 71 | if (cmdline[cI] == '\0') |
72 | { | 72 | { |
73 | args[argI]= argstart; | 73 | args[argI]= argstart; |
74 | argstart = &cmdline[cI+1]; | 74 | argstart = &cmdline[cI+1]; |
75 | argI++; | 75 | argI++; |
76 | if (*argstart == '\0') | 76 | if (*argstart == '\0') |
@@ -89,11 +89,11 @@ void loader_main() | |||
89 | snprintf(confFile, 255, "%s/.loader.conf", getenv("HOME")); | 89 | snprintf(confFile, 255, "%s/.loader.conf", getenv("HOME")); |
90 | 90 | ||
91 | struct stat confFileStat; | 91 | struct stat confFileStat; |
92 | 92 | ||
93 | stat(confFile, &confFileStat); | 93 | stat(confFile, &confFileStat); |
94 | 94 | ||
95 | int confFd = open(confFile, O_RDONLY); | 95 | int confFd = open(confFile, O_RDONLY); |
96 | 96 | ||
97 | if (confFd == -1) | 97 | if (confFd == -1) |
98 | { | 98 | { |
99 | close(confFd); | 99 | close(confFd); |
@@ -111,7 +111,7 @@ void loader_main() | |||
111 | close(confFd); | 111 | close(confFd); |
112 | return; | 112 | return; |
113 | } | 113 | } |
114 | 114 | ||
115 | close(confFd); | 115 | close(confFd); |
116 | size_t fI = 0; | 116 | size_t fI = 0; |
117 | int matchId = 0; | 117 | int matchId = 0; |
@@ -123,17 +123,17 @@ void loader_main() | |||
123 | { | 123 | { |
124 | names[matchId] = &conf[fI+1]; | 124 | names[matchId] = &conf[fI+1]; |
125 | conf[fI] = '\0'; | 125 | conf[fI] = '\0'; |
126 | 126 | ||
127 | matchId++; | 127 | matchId++; |
128 | } | 128 | } |
129 | } | 129 | } |
130 | 130 | ||
131 | remove_trailing_spaces(names[matchId-1]); | 131 | remove_trailing_spaces(names[matchId-1]); |
132 | 132 | ||
133 | read_cmdline(); | 133 | read_cmdline(); |
134 | 134 | ||
135 | make_args(); | 135 | make_args(); |
136 | 136 | ||
137 | #ifdef DEBUG | 137 | #ifdef DEBUG |
138 | int xarg=0; | 138 | int xarg=0; |
139 | while (args[xarg] != NULL) | 139 | while (args[xarg] != NULL) |
@@ -144,18 +144,18 @@ void loader_main() | |||
144 | #endif | 144 | #endif |
145 | 145 | ||
146 | int x; | 146 | int x; |
147 | 147 | ||
148 | for (x = 0;x<matchId;x++) | 148 | for (x = 0;x<matchId;x++) |
149 | { | 149 | { |
150 | DBG("%s\n",names[x]); | 150 | DBG("%s\n",names[x]); |
151 | if (strstr(args[0], names[x]) != NULL) | 151 | if (strstr(args[0], names[x]) != NULL) |
152 | { | 152 | { |
153 | DBG("highjack!\n"); | 153 | DBG("highjack!\n"); |
154 | 154 | ||
155 | free(conf); | 155 | free(conf); |
156 | 156 | ||
157 | execvp(loader, args ); | 157 | execvp(loader, args ); |
158 | } | 158 | } |
159 | } | 159 | } |
160 | 160 | ||
161 | } | 161 | } |
diff --git a/src/floader/makefile b/src/floader/makefile index 0de6a3138..eeb96571d 100644 --- a/src/floader/makefile +++ b/src/floader/makefile | |||
@@ -3,5 +3,3 @@ all: | |||
3 | 3 | ||
4 | debug: | 4 | debug: |
5 | gcc -ggdb -shared -DDEBUG -fPIC loader.c -o loader.so | 5 | gcc -ggdb -shared -DDEBUG -fPIC loader.c -o loader.so |
6 | |||
7 | |||