Use x_asprintf() instead of asprintf() + fatal()

This commit is contained in:
Joel Rosdahl 2009-12-10 21:55:30 +01:00
parent 3ebcc3b8c9
commit a00e4ae04e

4
util.c
View File

@ -259,9 +259,7 @@ const char *tmp_string(void)
gethostname(hostname, sizeof(hostname)-1);
#endif
hostname[sizeof(hostname)-1] = 0;
if (asprintf(&ret, "%s.%u", hostname, (unsigned)getpid()) == -1) {
fatal("could not allocate tmp_string\n");
}
x_asprintf(&ret, "%s.%u", hostname, (unsigned)getpid());
}
return ret;