#else
SetEnvironmentVariableA("LANG", "C");
#endif
- sprintf(cmd, SYSTEMQUOTE "\"%s/%s \"%s\"" SYSTEMQUOTE,
- cluster->bindir,
- live_check ? "pg_controldata\"" : "pg_resetxlog\" -n",
- cluster->pgdata);
+ snprintf(cmd, sizeof(cmd), SYSTEMQUOTE "\"%s/%s \"%s\"" SYSTEMQUOTE,
+ cluster->bindir,
+ live_check ? "pg_controldata\"" : "pg_resetxlog\" -n",
+ cluster->pgdata);
fflush(stdout);
fflush(stderr);
curr->reloid = atol(PQgetvalue(res, relnum, i_oid));
nspname = PQgetvalue(res, relnum, i_nspname);
- snprintf(curr->nspname, sizeof(curr->nspname), nspname);
+ strlcpy(curr->nspname, nspname, sizeof(curr->nspname));
relname = PQgetvalue(res, relnum, i_relname);
- snprintf(curr->relname, sizeof(curr->relname), relname);
+ strlcpy(curr->relname, relname, sizeof(curr->relname));
curr->relfilenode = atol(PQgetvalue(res, relnum, i_relfilenode));
curr->toastrelid = atol(PQgetvalue(res, relnum, i_reltoastrelid));
/* if no table tablespace, use the database tablespace */
if (strlen(tblspace) == 0)
tblspace = dbinfo->db_tblspace;
- snprintf(curr->tablespace, sizeof(curr->tablespace), "%s", tblspace);
+ strlcpy(curr->tablespace, tblspace, sizeof(curr->tablespace));
}
PQclear(res);
}
/* use -l for Win32 */
- sprintf(cmd, SYSTEMQUOTE "\"%s/pg_ctl\" -l \"%s\" -D \"%s\" "
- "-o \"-p %d -c autovacuum=off -c autovacuum_freeze_max_age=2000000000\" "
- "start >> \"%s\" 2>&1" SYSTEMQUOTE,
- bindir, ctx->logfile, datadir, port, ctx->logfile);
+ snprintf(cmd, sizeof(cmd),
+ SYSTEMQUOTE "\"%s/pg_ctl\" -l \"%s\" -D \"%s\" "
+ "-o \"-p %d -c autovacuum=off -c autovacuum_freeze_max_age=2000000000\" "
+ "start >> \"%s\" 2>&1" SYSTEMQUOTE,
+ bindir, ctx->logfile, datadir, port, ctx->logfile);
exec_prog(ctx, true, "%s", cmd);
/* wait for the server to start properly */