Re: C functions, arguments, and ssh oh my!

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: C functions, arguments, and ssh oh my!
Дата
Msg-id Pine.LNX.4.30.0103272154210.1215-100000@peter.localdomain
обсуждение исходный текст
Ответ на C functions, arguments, and ssh oh my!  (Joel Dudley <Joel.Dudley@DevelopOnline.com>)
Список 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@gmx.net       http://yi.org/peter-e/


В списке pgsql-general по дате отправления:

Предыдущее
От: Alfred Perlstein
Дата:
Сообщение: Re: C functions, arguments, and ssh oh my!
Следующее
От: Tom Lane
Дата:
Сообщение: Re: C functions, arguments, and ssh oh my!