Skip site navigation (1) Skip section navigation (2)

What's going wrong?

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: (view raw, whole thread or download thread mbox)
Lists: pgsql-interfaces

    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/'

    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?



pgsql-interfaces by date

Next:From: Ken KachnowichDate: 2000-10-16 23:37:04
Subject: Re: datetime fix
Previous:From: Alfred PerlsteinDate: 2000-10-16 22:25:33
Subject: Re: What's going wrong?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group