From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
To: | Joel Dudley <Joel(dot)Dudley(at)DevelopOnline(dot)com> |
Cc: | "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: C functions, arguments, and ssh oh my! |
Date: | 2001-03-27 19:55:48 |
Message-ID: | Pine.LNX.4.30.0103272154210.1215-100000@peter.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Joel Dudley writes:
> PG_FUNCTION_INFO_V1(ssh_exec);
>
> Datum
> ssh_exec(PG_FUNCTION_ARGS)
> {
> char sshcmd[255];
>
> strncpy(sshcmd, "/usr/local/bin/plsshexec ", 255);
> strncat(sshcmd, *uname, 255);
> strncat(sshcmd, " ", 255);
> strncat(sshcmd, *uid, 255);
> strncat(sshcmd, " ", 255);
> strncat(sshcmd, *gid, 255);
> system(sshcmd);
> return 0;
> }
You missed the part about fetching the arguments using PG_GETARG_xxx.
Also you should use PG_RETURN_xxx and you need to null-terminate your
string.
--
Peter Eisentraut peter_e(at)gmx(dot)net http://yi.org/peter-e/
From | Date | Subject | |
---|---|---|---|
Next Message | Hunter Hillegas | 2001-03-27 20:01:23 | Logging Queries |
Previous Message | Tom Lane | 2001-03-27 19:51:40 | Re: C functions, arguments, and ssh oh my! |