pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Igor Gavriloff <igor@nupes.cefetpr.br>
To: pgsql-interfaces@postgresql.org <pgsql-interfaces@postgresql.org>
Subject: What's going wrong?
Date: Mon, 16 Oct 2000 21:08:27 -0200
Message-ID: <39EB8A6B.E1EB3E44@nupes.cefetpr.br> (raw)

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.




view thread (2+ messages)

Message-ID: <39EB8A6B.E1EB3E44@nupes.cefetpr.br>
Permalink:  ../39EB8A6B.E1EB3E44@nupes.cefetpr.br/
Also on:    postgresql.org/message-id/39EB8A6B.E1EB3E44@nupes.cefetpr.br

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: igor@nupes.cefetpr.br
  Subject: Re: What's going wrong?
  In-Reply-To: <39EB8A6B.E1EB3E44@nupes.cefetpr.br>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox