MCPcopy Create free account
hub / github.com/apache/cloudberry / WriteInternalConfFile

Function WriteInternalConfFile

src/bin/pg_basebackup/pg_basebackup.c:2953–2979  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2951}
2952
2953static void
2954WriteInternalConfFile(void)
2955{
2956 char filename[MAXPGPATH];
2957 FILE *cf;
2958 char line_to_write[100];
2959 int length;
2960
2961 sprintf(filename, "%s/%s", basedir, GP_INTERNAL_AUTO_CONF_FILE_NAME);
2962
2963 cf = fopen(filename, "w");
2964 if (cf == NULL)
2965 {
2966 pg_log_error("could not create file \"%s\": %m", filename);
2967 exit(1);
2968 }
2969
2970 length = snprintf(line_to_write, 100, "gp_dbid=%d\n", target_gp_dbid);
2971
2972 if (fwrite(line_to_write, length, 1, cf) != 1)
2973 {
2974 pg_log_error("could not write to file \"%s\": %m", filename);
2975 exit(1);
2976 }
2977
2978 fclose(cf);
2979}

Callers 2

ReceiveAndUnpackTarFileFunction · 0.85
mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected