Improve form_serval_instance_path() error message

This commit is contained in:
Andrew Bettison 2013-04-04 17:46:09 +10:30
parent bc8c820bf3
commit c11ec7e8bf

View File

@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <stdlib.h>
#include "serval.h"
#include "str.h"
#include "os.h"
#include "strbuf.h"
#include "strbuf_helpers.h"
@ -48,7 +49,10 @@ int form_serval_instance_path(char *buf, size_t bufsiz, const char *path)
strbuf_path_join(b, serval_instancepath(), path, NULL);
if (!strbuf_overrun(b))
return 1;
WHYF("Cannot form pathname \"%s/%s\" -- buffer too small (%lu bytes)", serval_instancepath(), path, (unsigned long)bufsiz);
WHYF("Cannot form pathname from %s and %s -- buffer too small (%lu bytes)",
alloca_str_toprint(serval_instancepath()),
alloca_str_toprint(path),
(unsigned long)bufsiz);
return 0;
}