All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philip Craig <philipc@snapgear.com>
To: Charles Romestant <cromestant@gmail.com>
Cc: Jan Engelhardt <jengelh@computergmbh.de>, netfilter@vger.kernel.org
Subject: Re: C code rule modifying
Date: Tue, 22 Apr 2008 11:05:04 +1000	[thread overview]
Message-ID: <480D39C0.4000102@snapgear.com> (raw)
In-Reply-To: <5078d3df0804211613o3213bdeege5054ff95e558d51@mail.gmail.com>

Charles Romestant wrote:
> Ok im trying to add the rule to a table named charz, here is the code :
> 
> char *command;
>         FILE *fp = popen("/sbin/iptables",'w');

That should be "w" (a string, not a char).

>         if (fp==NULL){
>         printf("\nerror opening pipe\n");
>         return -1;
>         }else{
>         sprintf(command,"-A charz -p tcp --dport %s --source %s -j
> %s\0",port,currentIp,action2);
>         printf("\n\n\n%s\n\n\n",command);
>         fwrite(command,strlen(command),1,fp);
>         pclose(fp);

If that still doesn't fix it then use valgrind to find the
exact line number.


  reply	other threads:[~2008-04-22  1:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-21 22:05 C code rule modifying Charles Romestant
2008-04-21 22:42 ` Jan Engelhardt
2008-04-21 23:13   ` Charles Romestant
2008-04-22  1:05     ` Philip Craig [this message]
2008-04-22  1:16     ` Ming-Ching Tiew
2008-04-22  1:33       ` Charles M. Romestant F.
2008-04-22  8:48         ` Bernd Petrovitsch
2008-04-22 12:26           ` Charles Romestant
2008-04-22  7:59     ` Покотиленко Костик
2008-04-22 12:34     ` Jan Engelhardt

Reply instructions:

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

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

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=480D39C0.4000102@snapgear.com \
    --to=philipc@snapgear.com \
    --cc=cromestant@gmail.com \
    --cc=jengelh@computergmbh.de \
    --cc=netfilter@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.