Compare commits
2 commits
80bc6c62c3
...
2ca8e9ada3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2ca8e9ada3 | ||
|
|
70023cb48f |
4 changed files with 49 additions and 4 deletions
2
ipc.h
2
ipc.h
|
|
@ -40,4 +40,4 @@ typedef struct ipc {
|
|||
|
||||
} ipc_t;
|
||||
|
||||
#define SERVER_PATH "/tmp/rogue-enemy.sock"
|
||||
#define SERVER_PATH "/home/rogue-enemy.sock"
|
||||
31
notes/launch.json
Normal file
31
notes/launch.json
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "(gdb) Launch",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build/allynone",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"miDebuggerPath": "/home/gamer/gdb",
|
||||
"MIMode": "gdb",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
|
||||
]
|
||||
}
|
||||
13
notes/vscode_debug.md
Normal file
13
notes/vscode_debug.md
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# Debug sudo application with vscode
|
||||
|
||||
1. create /home/gamer/gdb with following content:
|
||||
```
|
||||
sudo /usr/bin/gdb "$@"
|
||||
```
|
||||
|
||||
2. add this line to /etc/sudoers
|
||||
```
|
||||
gamer ALL=(ALL) NOPASSWD:/usr/bin/gdb
|
||||
```
|
||||
|
||||
then copy the launch.json in this folder into .vscode folder
|
||||
|
|
@ -110,15 +110,16 @@ int main(int argc, char ** argv) {
|
|||
|
||||
// here the client_fd is good
|
||||
if (pthread_mutex_lock(&dev_out_thread_data.communication.endpoint.ssocket.mutex) == 0) {
|
||||
int i;
|
||||
for (i = 0; i < MAX_CONNECTED_CLIENTS; ++i) {
|
||||
bool found = false;
|
||||
for (size_t i = 0; i < MAX_CONNECTED_CLIENTS; ++i) {
|
||||
if (dev_out_thread_data.communication.endpoint.ssocket.clients[i] < 0) {
|
||||
dev_out_thread_data.communication.endpoint.ssocket.clients[i] = client_fd;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == MAX_CONNECTED_CLIENTS) {
|
||||
if (!found) {
|
||||
fprintf(stderr, "Could not find a free spot fot the incoming client -- client will be rejected\n");
|
||||
close(client_fd);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue