VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / arch / ppc64 / kernel / mf_proc.c
index 2992f28..3ac36a5 100644 (file)
@@ -25,33 +25,26 @@ static int proc_mf_dump_cmdline(char *page, char **start, off_t off,
 {
        int len = count;
        char *p;
-    
+
+       if (off) {
+               *eof = 1;
+               return 0;
+       }
+
        len = mf_getCmdLine(page, &len, (u64)data);
    
-       p = page + len - 1;
-       while (p > page) {
-               if ((*p == 0) || (*p == ' '))
-                       --p;
-               else
+       p = page;
+       while (len < (count - 1)) {
+               if (!*p || *p == '\n')
                        break;
+               p++;
+               len++;
        }
-       if (*p != '\n') {
-               ++p;
-               *p = '\n';
-       }
-       ++p;
+       *p = '\n';
+       p++;
        *p = 0;
-       len = p - page;
-    
-       len -= off;                     
-       if (len < count) {              
-               *eof = 1;               
-               if (len <= 0)           
-                       return 0;       
-       } else                          
-               len = count;            
-       *start = page + off;            
-       return len;                     
+
+       return p - page;
 }
 
 #if 0
@@ -177,10 +170,14 @@ static int proc_mf_change_cmdline(struct file *file, const char *buffer,
 static int proc_mf_change_vmlinux(struct file *file, const char *buffer,
                unsigned long count, void *data)
 {
+       int rc;
        if (!capable(CAP_SYS_ADMIN))
                return -EACCES;
 
-       mf_setVmlinuxChunk(buffer, count, file->f_pos, (u64)data);
+       rc = mf_setVmlinuxChunk(buffer, count, file->f_pos, (u64)data);
+       if (rc < 0)
+               return rc;
+
        file->f_pos += count;
 
        return count;