From: | Igor Gavriloff <igor(at)nupes(dot)cefetpr(dot)br> |
---|---|
To: | "pgsql-interfaces(at)postgresql(dot)org" <pgsql-interfaces(at)postgresql(dot)org> |
Subject: | What's going wrong? |
Date: | 2000-10-16 23:08:27 |
Message-ID: | 39EB8A6B.E1EB3E44@nupes.cefetpr.br |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
Hi,
I'm trying to write a function in C that I can load into postgres,
that basically removes a file from the system (quite unsafe thought, but
it'll be suitable for me here):
#include <postgres.h>
#include <stdio.h>
bool file_remove(text *this)
{
if (remove((char *)this) == 0) return (true);
else return (false);
}
I compile it and link as instructed for Solaris (where the backend
runs), and load it with:
CREATE FUNCTION file_remove(text) RETURNS bool AS '/path/file_remove.so'
LANGUAGE 'c';
But it always returns false when I try to remove something. I'm sure
that I'm trying to remove files that the the backend's user owns (have
write access). If I try to make any changes on this code (eg.: the
casts...), when I try to use it the backends terminates abnormally.
Does someone can give me a clue?
Thanks,
Igor.
From | Date | Subject | |
---|---|---|---|
Next Message | Ken Kachnowich | 2000-10-16 23:37:04 | Re: datetime fix |
Previous Message | Alfred Perlstein | 2000-10-16 22:25:33 | Re: What's going wrong? |