aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-04-06 17:05:51 +0200
committerdec05eba <dec05eba@protonmail.com>2024-04-06 17:05:51 +0200
commit309996daa538127610af25926a0973d5558c1dff (patch)
treef4d73cad4b56c9160ab2f0b7a4efab01cab92234
parent756865fe13b55b585a96d415a7bb718395e221c1 (diff)
Add error messages
-rw-r--r--main.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/main.c b/main.c
index 3a40e08..4113c98 100644
--- a/main.c
+++ b/main.c
@@ -110,8 +110,10 @@ static int create_local_kms_server_proxy_file(const char *source_path, const cha
}
int main(int argc, char **argv) {
- if(argc != 4)
+ if(argc != 4) {
+ fprintf(stderr, "usage: kms-server-proxy <initial_socket_path> <card_path> <user_homepath>\n");
return 1;
+ }
const char *gsr_kms_server_filepath = "/var/lib/flatpak/app/com.dec05eba.gpu_screen_recorder/current/active/files/bin/gsr-kms-server";
const char *initial_socket_path = argv[1];
@@ -119,8 +121,10 @@ int main(int argc, char **argv) {
const char *user_homepath = argv[3];
char self_path[PATH_MAX];
- if(!readlink_realpath("/proc/self/exe", self_path))
+ if(!readlink_realpath("/proc/self/exe", self_path)) {
+ fprintf(stderr, "failed to resolve /proc/self/exe\n");
return 1;
+ }
char kms_server_proxy_local_filepath[PATH_MAX];
/* Update kms-server-proxy-N to kms-server-proxy-N+1 on update (update that needs to run before this program launches itself) */
@@ -132,8 +136,10 @@ int main(int argc, char **argv) {
} else if(file_has_sys_admin_capability(kms_server_proxy_local_filepath)) {
/* Need to resolve kms_server_proxy_local_filepath because /home can be a symlink to another location */
char kms_server_proxy_local_filepath_full[PATH_MAX];
- if(!readlink_realpath(kms_server_proxy_local_filepath, kms_server_proxy_local_filepath_full))
+ if(!readlink_realpath(kms_server_proxy_local_filepath, kms_server_proxy_local_filepath_full)) {
+ fprintf(stderr, "failed to resolve %s\n", kms_server_proxy_local_filepath);
return 1;
+ }
/*
Run cached ~/.local/share/gpu-screen-recorder/kms-server-proxy which has sys admin capability.