Skip to content

Commit

Permalink
PG-947 Set 0644 mode for telemetry files (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
artemgavrilov authored Aug 2, 2024
1 parent b7dffc7 commit 4d06aa3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions percona_pg_telemetry.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ PG_MODULE_MAGIC;
/* General defines */
#define PT_BUILD_VERSION "1.0"
#define PT_FILENAME_BASE "percona_pg_telemetry"
#define PT_FILE_MODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)

/* Init and exported functions */
void _PG_init(void);
Expand Down Expand Up @@ -1026,6 +1027,9 @@ percona_pg_telemetry_main(Datum main_arg)
/* Generate and save the filename */
telemetry_file_next(generate_filename(filename));

/* Change the file permissions before making it available to the agent. */
chmod(ptss->dbtemp_filepath, PT_FILE_MODE);

/* Let's rename the temp file so that agent can pick it up. */
if (rename(ptss->dbtemp_filepath, telemetry_curr_filename()) < 0)
{
Expand Down

0 comments on commit 4d06aa3

Please sign in to comment.