aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/os-Linux/mem.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/os-Linux/mem.c')
-rw-r--r--arch/um/os-Linux/mem.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/arch/um/os-Linux/mem.c b/arch/um/os-Linux/mem.c
index c6432e729241..d24d1a960523 100644
--- a/arch/um/os-Linux/mem.c
+++ b/arch/um/os-Linux/mem.c
@@ -55,7 +55,7 @@ static void __init find_tempdir(void)
55 */ 55 */
56static int next(int fd, char *buf, int size, char c) 56static int next(int fd, char *buf, int size, char c)
57{ 57{
58 int n; 58 int n, len;
59 char *ptr; 59 char *ptr;
60 60
61 while((ptr = strchr(buf, c)) == NULL){ 61 while((ptr = strchr(buf, c)) == NULL){
@@ -69,7 +69,17 @@ static int next(int fd, char *buf, int size, char c)
69 } 69 }
70 70
71 ptr++; 71 ptr++;
72 memmove(buf, ptr, strlen(ptr) + 1); 72 len = strlen(ptr);
73 memmove(buf, ptr, len + 1);
74
75 /* Refill the buffer so that if there's a partial string that we care
76 * about, it will be completed, and we can recognize it.
77 */
78 n = read(fd, &buf[len], size - len - 1);
79 if(n < 0)
80 return -errno;
81
82 buf[len + n] = '\0';
73 return 1; 83 return 1;
74} 84}
75 85