Backport: Introduce LTTNG_RELAYD_WORKING_DIRECTORY environment variable
[lttng-tools.git] / src / bin / lttng-relayd / main.c
index 7f0b413bcbb789b83422255aad252e71c3b8e0d5..c171dfdfe41de54b126d8928a680c496e5890e18 100644 (file)
@@ -374,6 +374,16 @@ end:
        return ret;
 }
 
+static void parse_env_options(void)
+{
+       char *value = NULL;
+
+       value = lttng_secure_getenv(DEFAULT_LTTNG_RELAYD_WORKING_DIRECTORY_ENV);
+       if (value) {
+               opt_working_directory = value;
+       }
+}
+
 static int set_options(int argc, char **argv)
 {
        int c, ret = 0, option_index = 0, retval = 0;
@@ -3156,7 +3166,13 @@ int main(int argc, char **argv)
        int ret = 0, retval = 0;
        void *status;
 
-       /* Parse arguments */
+       /* Parse environment variables */
+       parse_env_options();
+
+       /*
+        * Parse arguments.
+        * Command line arguments overwrite environment.
+        */
        progname = argv[0];
        if (set_options(argc, argv)) {
                retval = -1;
This page took 0.043758 seconds and 5 git commands to generate.