fix off-by-one error
authorAndre <maan@p133.(none)>
Thu, 2 Mar 2006 14:08:38 +0000 (15:08 +0100)
committerAndre <maan@p133.(none)>
Thu, 2 Mar 2006 14:08:38 +0000 (15:08 +0100)
Also, make "bufsize" const instead of static.

gui_common.c

index 2c49912..d806ebe 100644 (file)
@@ -13,8 +13,9 @@ int para_open_audiod_pipe(char *cmd)
 
 int read_audiod_pipe(int fd, void (*line_handler)(char *) )
 {
-       static char buf[STRINGSIZE + 1];
-       static ssize_t loaded, bufsize = sizeof(buf);
+       static char buf[STRINGSIZE];
+       const ssize_t bufsize = sizeof(buf) - 1;
+       static ssize_t loaded;
        ssize_t ret;
 
        if (loaded >= bufsize)