Re: [PATCH][2.1.78] procfs pedantry

Matthew Kirkwood (weejock@ferret.lmh.ox.ac.uk)
Thu, 8 Jan 1998 12:16:48 +0000 (GMT)


On Thu, 8 Jan 1998, Matthew Kirkwood wrote:

> G'day, y'all...

And I forgot the patch. Again :)

--- linux/fs/proc/root.c.orig Thu Jan 8 11:42:48 1998
+++ linux/fs/proc/root.c Thu Jan 8 11:47:07 1998
@@ -746,20 +746,21 @@
pid = 0;
name = dentry->d_name.name;
len = dentry->d_name.len;
- while (len-- > 0) {
- c = *name - '0';
- name++;
- if (c > 9) {
- pid = 0;
- break;
+ if(*name!='0')
+ while (len-- > 0) {
+ c = *name - '0';
+ name++;
+ if (c > 9) {
+ pid = 0;
+ break;
+ }
+ pid *= 10;
+ pid += c;
+ if (pid & 0xffff0000) {
+ pid = 0;
+ break;
+ }
}
- pid *= 10;
- pid += c;
- if (pid & 0xffff0000) {
- pid = 0;
- break;
- }
- }
p = find_task_by_pid(pid);
inode = NULL;
if (pid && p) {