adde grimoire support files
[grimoire-witchcraft.git] / utils / installwatch / installwatch-buffer.diff
blobc6c809395ac31293188a52c3fb6bfb316de36399
1 diff -urN installwatch-0.6.3.ori/installwatch.c installwatch-0.6.3/installwatch.c
2 --- installwatch-0.6.3.ori/installwatch.c 2004-08-30 14:47:35.917768321 +0000
3 +++ installwatch-0.6.3/installwatch.c 2004-08-30 14:51:30.568600728 +0000
4 @@ -142,11 +142,17 @@
5 va_start(ap, format);
6 count = vsnprintf(buffer, BUFSIZE, format, ap);
7 va_end(ap);
9 + buffer [BUFSIZE - 2] = '\n';
10 + buffer [BUFSIZE - 1] = 0;
12 if(count == -1) {
13 /* The buffer was not big enough */
14 strcpy(&(buffer[BUFSIZE - 5]), "...\n");
15 count = BUFSIZE - 1;
16 - }
17 + } else {
18 + count = strlen(buffer);
19 + }
20 if((logname = getenv("INSTALLWATCHFILE"))) {
21 logfd = true_open(logname, O_WRONLY | O_CREAT | O_APPEND, 0666);
22 if(logfd >= 0) {
23 @@ -179,8 +185,9 @@
24 * to the current working directory if it was not
25 * an absolute path */
26 getcwd(resolved_path, MAXPATHLEN - 2);
27 + resolved_path[MAXPATHLEN - 2] = 0;
28 strcat(resolved_path, "/");
29 - strncat(resolved_path, path, MAXPATHLEN - 1);
30 + strncat(resolved_path, path, MAXPATHLEN - 1 - strlen(resolved_path));
33 errno = s_errno;