What is the best, secure way to write to a named pipe in Linux? Or, how can I make a named pipe secure?
Here's how I write to the pipe on linux using PHP:
$con = fopen("/tmp/myFIFO", "w");
fwrite($con, "UP
");
fclose($con);
I wish to make it more secure.
This is how I create the pipe in C:
int pc;
char mode[] = "0777";
int i = strtol(mode, 0, 8);
pc = mkfifo(FIFO, 0);
if(pc < 0) {
printf("Failed in creating a pipe
");
printf("Exiting...
");
exit(1);
}
else {
printf("Success in Creating Pipe
");
chmod("/tmp/myFIFO", i);
}