Commit 1e0bb694 authored by Lasse Karstensen's avatar Lasse Karstensen

Remove implicit line feed when using formatfile.

Fixes: #1967
parent 12b48097
......@@ -1103,12 +1103,14 @@ read_format(const char *formatfile)
{
FILE *fmtfile;
size_t len = 0;
int fmtlen;
char *fmt = NULL;
fmtfile = fopen(formatfile, "r");
if (fmtfile == NULL)
VUT_Error(1, "Can't open format file (%s)", strerror(errno));
if (getline(&fmt, &len, fmtfile) == -1) {
fmtlen = getline(&fmt, &len, fmtfile);
if (fmtlen == -1) {
free(fmt);
if (feof(fmtfile))
VUT_Error(1, "Empty format file");
......@@ -1117,6 +1119,8 @@ read_format(const char *formatfile)
strerror(errno));
}
fclose(fmtfile);
if (fmt[fmtlen - 1] == '\n')
fmt[fmtlen - 1] = '\0';
return (fmt);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment