LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
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, 09: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, 09:52 AM   #2
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,530

Rep: Reputation: 108Reputation: 108
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 07:50 AM
Problem using 'read' system call buckles Programming 6 05-10-2005 12:45 PM
Problem w/ 'read' system call - RH 7.3 buckles Linux - Newbie 3 05-07-2005 01:03 AM
problem in intercepting sys_write system call appas Programming 7 09-03-2004 01:33 PM
a CGI written in C, problem with an fopen() system call Sm0k3 Programming 2 10-03-2003 03:18 PM


All times are GMT -5. The time now is 03:43 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration