Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 14e6858

Browse files
committed
Make the win32 implementation of getrusage() return EINVAL if being
asked for anything other than RUSAGE_SELF, since it's not supported. This is never called anywhere in the code today, but might be in the future. Not backpatching, since it's not called anywhere today.
1 parent 36f0b1c commit 14e6858

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/port/getrusage.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/port/getrusage.c,v 1.14 2008/01/01 19:46:00 momjian Exp $
11+
* $PostgreSQL: pgsql/src/port/getrusage.c,v 1.15 2008/05/14 07:28:13 mha Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -41,6 +41,13 @@ getrusage(int who, struct rusage * rusage)
4141
FILETIME usertime;
4242
ULARGE_INTEGER li;
4343

44+
if (who != RUSAGE_SELF)
45+
{
46+
/* Only RUSAGE_SELF is supported in this implementation for now */
47+
errno = EINVAL;
48+
return -1;
49+
}
50+
4451
if (rusage == (struct rusage *) NULL)
4552
{
4653
errno = EFAULT;

0 commit comments

Comments
 (0)