LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-04-2004, 08:23 AM   #1
ppy
LQ Newbie
 
Registered: Nov 2004
Location: India,Bangalore
Posts: 5

Rep: Reputation: 0
Smile Problem in setgroups system call


I am running the following code on two different distributions on different machines ,

main()
{
int ret;

ret = setgroups(33,0);
printf("ret %d error %d\n",ret,errno);
perror(" ");
}

I am getting different outputs like :

machine 1, distribution 1 :
ret -1 error 14
: bad address
Hardware details : Intel Xeon P4 2ghz, 256mb ram
Distribution : my own build system

machine 2, distribution 2 :
ret -1 error 22
: Invalid argument
Hardware details : Intel P4 2ghz, 256mb ram
Distribution : Redhat fedora v10

Why is this so ?

Thanks in adavance,
Prashant P Y
 
Old 11-04-2004, 08:52 AM   #2
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
Re: Problem in setgroups system call

Quote:
Originally posted by ppy
ret = setgroups(33,0);
The prototype for setgroups() is:
Code:
int setgroups(size_t size, const gid_t *list);
So, when you call
Code:
setgroups(33,0);
You are passing 0 as the pointer where setgroups() can find 33 gid's ?!?!?
"bas address" it says. Not really surprising IMHO...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with adding a system call newcat Programming 17 04-08-2006 06:50 AM
Problem using 'read' system call buckles Programming 6 05-10-2005 11:45 AM
Problem w/ 'read' system call - RH 7.3 buckles Linux - Newbie 3 05-07-2005 12:03 AM
problem in intercepting sys_write system call appas Programming 7 09-03-2004 12:33 PM
a CGI written in C, problem with an fopen() system call Sm0k3 Programming 2 10-03-2003 02:18 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration