From: Mark Wong Date: Thu, 26 Mar 2009 00:37:20 +0000 (-0700) Subject: Don't change the working directory inside the stored function. That can X-Git-Tag: v0.0.5~13^2~3 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=98dd5df7db1a56e1dc3a1da47d83f91d76823cd1;p=pg_proctab.git Don't change the working directory inside the stored function. That can keep the database from functioning properly. --- diff --git a/pg_proctab.c b/pg_proctab.c index 5706054..166d593 100644 --- a/pg_proctab.c +++ b/pg_proctab.c @@ -215,7 +215,6 @@ get_proctab(FuncCallContext *funcctx, char **values) elog(ERROR, "proc filesystem not mounted on " PROCFS "\n"); return 0; } - chdir(PROCFS); /* Read the stat info for the pid. */ @@ -267,7 +266,7 @@ get_proctab(FuncCallContext *funcctx, char **values) } /* Get the process table information for the pid. */ - sprintf(buffer, "%d/stat", pid); + sprintf(buffer, "%s/%d/stat", PROCFS, pid); fd = open(buffer, O_RDONLY); if (fd == -1) {