When parsing /proc/mounts looking for a tmpfs mount on /dev/shm, if
a string that we are looking for if split across reads, then it
won't be recognized.
Fix this by refilling the buffer whenever we advance the cursor.
Signed-off-by: Jeff Dike <[email protected]>
Index: linux-2.6.16-rc-mm/arch/um/os-Linux/mem.c
===================================================================
--- linux-2.6.16-rc-mm.orig/arch/um/os-Linux/mem.c 2006-06-11 14:27:36.000000000 -0400
+++ linux-2.6.16-rc-mm/arch/um/os-Linux/mem.c 2006-06-28 13:07:35.000000000 -0400
@@ -55,7 +55,7 @@ static void __init find_tempdir(void)
*/
static int next(int fd, char *buf, int size, char c)
{
- int n;
+ int n, len;
char *ptr;
while((ptr = strchr(buf, c)) == NULL){
@@ -69,7 +69,17 @@ static int next(int fd, char *buf, int s
}
ptr++;
- memmove(buf, ptr, strlen(ptr) + 1);
+ len = strlen(ptr);
+ memmove(buf, ptr, len + 1);
+
+ /* Refill the buffer so that if there's a partial string that we care
+ * about, it will be completed, and we can recognize it.
+ */
+ n = read(fd, &buf[len], size - len - 1);
+ if(n < 0)
+ return -errno;
+
+ buf[len + n] = '\0';
return 1;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]