str = malloc (len);
if (str == NULL) {
perror ("malloc");
- exit (1);
+ exit (EXIT_FAILURE);
}
strcpy (str, home);
strcat (str, rest);
home = getenv ("HOME");
if (!home) home = "~";
- len = strlen (home) + (append ? strlen (append) : 0);
+ len = strlen (home) + (append ? strlen (append) : 0) + 1;
str = malloc (len);
if (str == NULL) {
perror ("malloc");
- exit (1);
+ exit (EXIT_FAILURE);
}
strcpy (str, home);