~ubuntu-branches/ubuntu/raring/uml-utilities/raring

« back to all changes in this revision

Viewing changes to uml_net/host.c

  • Committer: Bazaar Package Importer
  • Author(s): Matt Zimmerman
  • Date: 2004-04-14 17:59:45 UTC
  • mto: (4.1.3 hardy)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20040414175945-yluoug8v60dnwmvu
Tags: upstream-20040406
ImportĀ upstreamĀ versionĀ 20040406

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
    exit(1);
42
42
  }
43
43
  else if(pid < 0){
44
 
    perror("fork failed");
 
44
    output_errno(output, "fork failed");
45
45
    return(-1);
46
46
  }
47
47
  if(output){
48
48
    close(fds[1]);
49
49
    while((n = read(fds[0], buf, sizeof(buf))) > 0) add_output(output, buf, n);
50
 
    if(n < 0) perror("Reading command output");
 
50
    if(n < 0) output_errno(output, "Reading command output");
51
51
  }
52
52
  if(waitpid(pid, &status, 0) < 0){
53
 
    perror("execvp");
 
53
    output_errno(output, "waitpid");
54
54
    return(-1);
55
55
  }
56
56
  if(need_zero && (!WIFEXITED(status) || (WEXITSTATUS(status) != 0))){
57
 
    printf("'%s' didn't exit with status 0\n", args[0]);
 
57
    sprintf(buf, "'%s' didn't exit with status 0\n", args[0]);
 
58
    add_output(output, buf, -1);
58
59
    return(-1);
59
60
  }
60
61
  return(0);
242
243
                 struct output *output)
243
244
{
244
245
  if(setreuid(0, 0) < 0){
245
 
    perror("setreuid");
 
246
    output_errno(output, "setreuid");
246
247
    exit(1);
247
248
  }
248
249
  if(!strcmp(op, "add")) route_and_arp(dev, address, netmask, 0, output);