X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=fish%2Ftilde.c;h=83aa70d9a6708656dfcfabb0869a82bfc47cd561;hp=64b5b399f0e5546abb3bdfdf48f5f5421828bb20;hb=371e83c0902d0f6949a09095b1b10280d8881aac;hpb=3e70b34eed5a48640e20fbf6dcba774aaace1f3c diff --git a/fish/tilde.c b/fish/tilde.c index 64b5b39..83aa70d 100644 --- a/fish/tilde.c +++ b/fish/tilde.c @@ -62,7 +62,7 @@ try_tilde_expansion (char *str) str = malloc (len); if (str == NULL) { perror ("malloc"); - exit (1); + exit (EXIT_FAILURE); } strcpy (str, home); strcat (str, rest); @@ -85,11 +85,11 @@ expand_home (const char *append) 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);