Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6
[pandora-kernel.git] / arch / um / os-Linux / drivers / ethertap_user.c
index 96e12ea..acba301 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) and 
+ * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) and
  * James Leu (jleu@mindspring.net).
  * Copyright (C) 2001 by various other people who didn't put their name here.
  * Licensed under the GPL.
@@ -48,9 +48,12 @@ static void etap_change(int op, unsigned char *addr, unsigned char *netmask,
        change.what = op;
        memcpy(change.addr, addr, sizeof(change.addr));
        memcpy(change.netmask, netmask, sizeof(change.netmask));
-       n = os_write_file(fd, &change, sizeof(change));
-       if(n != sizeof(change))
-               printk("etap_change - request failed, err = %d\n", -n);
+       CATCH_EINTR(n = write(fd, &change, sizeof(change)));
+       if(n != sizeof(change)){
+               printk("etap_change - request failed, err = %d\n", errno);
+               return;
+       }
+
        output = um_kmalloc(UM_KERN_PAGE_SIZE);
        if(output == NULL)
                printk("etap_change : Failed to allocate output buffer\n");
@@ -116,13 +119,15 @@ static int etap_tramp(char *dev, char *gate, int control_me,
        pe_data.data_me = data_me;
        pid = run_helper(etap_pre_exec, &pe_data, args, NULL);
 
-       if(pid < 0) err = pid;
+       if(pid < 0)
+               err = pid;
        os_close_file(data_remote);
        os_close_file(control_remote);
-       n = os_read_file(control_me, &c, sizeof(c));
+       CATCH_EINTR(n = read(control_me, &c, sizeof(c)));
        if(n != sizeof(c)){
-               printk("etap_tramp : read of status failed, err = %d\n", -n);
-               return -EINVAL;
+               err = -errno;
+               printk("etap_tramp : read of status failed, err = %d\n", -err);
+               return err;
        }
        if(c != 1){
                printk("etap_tramp : uml_net failed\n");