Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 07-07-2004, 07:46 PM   #1
Registered: Oct 2003
Posts: 41

Rep: Reputation: 15
Unhappy cant find the problem..pls help ?????

Hi Gurus,
need your help,
i am stuck with this piece of code where I try to run exportfs -r from my C code. No error is reported but nothing expected comes out either. Here is what I do: (/etc/exports is modified, which confirms that setuid is working ok)

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
/* getting and setting advanced permissions for the script */
int ruid = getuid();
int euid = geteuid();

strcpy(root_fs, argv[1]);

if (setuid(euid) == -1) {
return 1;

fd = fopen("/etc/exports", "r+");
if (fd == NULL) {
printf("Error: can't open file.\n");
return 1;

/* Adding the line in /etc/exports */

fprintf(fd, "%s", argv[1]);
fprintf(fd, "%s", " *(rw)");
fprintf(fd, "%s", "\n");

/* Executing exportfs -a */

// retval = system("/usr/sbin/exportfs -r");

if (retval != 0){
printf("Error in executing exportfs -r");
return 1;

return 0;

Any help will be greatly appreciated


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
Latest quota-tools rpm - Where to find pls? (Newbie) KDoc Red Hat 0 08-11-2004 12:40 AM
pls help me to find a multimedia player sanjaya Linux - Software 8 02-16-2004 11:25 PM
pls pls pls help me ! i'm tired with httpd config on fedora apache 2.0.48 AngelOfTheDamn Fedora 0 01-24-2004 06:12 PM
Mail Problem, pls help kcwoo Linux - General 1 02-07-2002 03:55 PM
trouble pls help BZFlag crashes no error message that I can find Cor_Tauri Linux - Newbie 2 07-15-2001 07:49 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:26 AM.

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