]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/compat.c
[PATCH] autofs4 needs to force fail return revalidate
[linux-2.6-omap-h63xx.git] / fs / compat.c
index 7e7e5bc4f3cf39b84d1eb95e1a5d998c6f0afa4c..ce982f6e8c80270be3fd23f8f9553c486626986e 100644 (file)
 
 extern void sigset_from_compat(sigset_t *set, compat_sigset_t *compat);
 
+int compat_log = 1;
+
+int compat_printk(const char *fmt, ...)
+{
+       va_list ap;
+       int ret;
+       if (!compat_log)
+               return 0;
+       va_start(ap, fmt);
+       ret = vprintk(fmt, ap);
+       va_end(ap);
+       return ret;
+}
+
 /*
  * Not all architectures have sys_utime, so implement this in terms
  * of sys_utimes.
@@ -359,7 +373,7 @@ static void compat_ioctl_error(struct file *filp, unsigned int fd,
        sprintf(buf,"'%c'", (cmd>>24) & 0x3f);
        if (!isprint(buf[1]))
                sprintf(buf, "%02x", buf[1]);
-       printk("ioctl32(%s:%d): Unknown cmd fd(%d) "
+       compat_printk("ioctl32(%s:%d): Unknown cmd fd(%d) "
                        "cmd(%08x){%s} arg(%08x) on %s\n",
                        current->comm, current->pid,
                        (int)fd, (unsigned int)cmd, buf,
@@ -1841,7 +1855,7 @@ asmlinkage long compat_sys_pselect7(int n, compat_ulong_t __user *inp,
 
        } while (!ret && !timeout && tsp && (ts.tv_sec || ts.tv_nsec));
 
-       if (tsp && !(current->personality & STICKY_TIMEOUTS)) {
+       if (ret == 0 && tsp && !(current->personality & STICKY_TIMEOUTS)) {
                struct compat_timespec rts;
 
                rts.tv_sec = timeout / HZ;
@@ -1852,7 +1866,8 @@ asmlinkage long compat_sys_pselect7(int n, compat_ulong_t __user *inp,
                }
                if (compat_timespec_compare(&rts, &ts) >= 0)
                        rts = ts;
-               copy_to_user(tsp, &rts, sizeof(rts));
+               if (copy_to_user(tsp, &rts, sizeof(rts)))
+                       ret = -EFAULT;
        }
 
        if (ret == -ERESTARTNOHAND) {