aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-11-24 22:52:12 +0100
committerdec05eba <dec05eba@protonmail.com>2024-11-24 22:52:12 +0100
commitd472d8d41eacd512bfc4693e212c6c17846857ef (patch)
tree2a69f173e8fb5ef58a5017fadd56ffedd0508915 /src/main.cpp
parent8644c72ac916d708b5f8b0e4dd248ddd3c55dd00 (diff)
Dont allow running the program as the root user
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 583d9e5..f415dd8 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1123,9 +1123,10 @@ static void usage_full() {
fprintf(stderr, " Optional when using '-bm qp' or '-bm vbr' options, set to 'very_high' be default.\n");
fprintf(stderr, " Required when using '-bm cbr' option.\n");
fprintf(stderr, "\n");
- fprintf(stderr, " -r Replay buffer size in seconds. If this is set, then only the last seconds as set by this option will be stored\n");
- fprintf(stderr, " and the video will only be saved when the gpu-screen-recorder is closed. This feature is similar to Nvidia's instant replay feature.\n");
- fprintf(stderr, " This option has be between 5 and 1200. Note that the replay buffer size will not always be precise, because of keyframes. Optional, disabled by default.\n");
+ fprintf(stderr, " -r Replay buffer time in seconds. If this is set, then only the last seconds as set by this option will be stored\n");
+ fprintf(stderr, " and the video will only be saved when the gpu-screen-recorder is closed. This feature is similar to Nvidia's instant replay feature This option has be between 5 and 1200.\n");
+ fprintf(stderr, " Note that the video data is stored in RAM, so don't use too long replay buffer time and use constant bitrate option (-bm cbr) to prevent RAM usage from going too high in busy scenes.\n");
+ fprintf(stderr, " Optional, disabled by default.\n");
fprintf(stderr, "\n");
fprintf(stderr, " -k Video codec to use. Should be either 'auto', 'h264', 'hevc', 'av1', 'vp8', 'vp9', 'hevc_hdr', 'av1_hdr', 'hevc_10bit' or 'av1_10bit'.\n");
fprintf(stderr, " Optional, set to 'auto' by default which defaults to 'h264'. Forcefully set to 'h264' if the file container type is 'flv'.\n");
@@ -2981,6 +2982,11 @@ int main(int argc, char **argv) {
// Same as above, but for amd/intel
unsetenv("vblank_mode");
+ if(geteuid() == 0) {
+ fprintf(stderr, "Error: don't run gpu-screen-recorder as the root user\n");
+ _exit(1);
+ }
+
if(argc <= 1)
usage_full();