Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8134237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:56:30+00:00 2026-06-06T09:56:30+00:00

I am writing a simple C program to exchange messages through named pipes on

  • 0

I am writing a simple C program to exchange messages
through named pipes on linux. The problem is I have
to run it as superuser to make it work, otherwise i get:
“Permission denied” error.
Write permission on the directory is granted:

drwxr-xr-x 2 alpa alpa  4096 26 giu 17.24 .

Umask should be ok:

$ umask
0022

The pipe file is actually created, but with wrong permissions bits:

$ ls -l | grep fifo.fifo
pr----x--t 1 alpa alpa     0 26 giu 17.29 fifo.fifo

So when I try to open it for reading or writing the
open() system call fails.

Here is the code:

...
if(mkfifo(pathname, perms) == -1 && errno != EEXIST)
  return NULL;
if(chmod(pathname, perms) == -1)
    return NULL;
...
fifo->fd[0]= open(fifo->pathname, O_RDONLY);
 if(fifo->fd[0] == -1){
fifo_delete(&fifo);
  return NULL;
...

Thank you in advance for your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T09:56:34+00:00Added an answer on June 6, 2026 at 9:56 am

    The value that you are passing is decimal 666, which corresponds to octal 01232 (01210 after applying ~umask).

    You should be passing either 0666, or decimal 438.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a simple program that will run entirely client-side. (Desktop programming? do people
I'm writing simple chat program in Ada, and I'm having problem with chat window
I am writing a simple program that uses perspective projection and I have a
I'm writing a simple program using SDL, but I'm running into a strange problem.
I'm writing a simple plugin based program. I have an interface IPlugin which has
I am writing simple client-server program. Client send some messages to server using UDP
I'm writing a simple MATLAB program to solve a project Euler problem. The program
Basically I am writing a simple program using the boost socket library... I have
I'm writing a simple program for testing mouse. It compiles fine, but doesn't work.
I'm writing simple program to communicate between smart devices and I receive 11001 when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.