diff options
author | pommicket <pommicket@gmail.com> | 2022-07-22 14:59:24 -0400 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2022-07-22 14:59:24 -0400 |
commit | 0b58ebbea977f34c5192ae6f0caec31f66749e9e (patch) | |
tree | 68500ee18d86ba17390adac951a1ac9d98d311a5 /main.c | |
parent | 35b1b0129e8791a9412173acf3756606d0cc397d (diff) |
fixed some compiler warnings
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -507,11 +507,17 @@ int main(int argc, char **argv) { { if (starting_filename) { if (fs_file_exists(starting_filename)) { - if (!ted_open_file(ted, starting_filename)) - ted_seterr(ted, "Couldn't load file: %s", ted_geterr(ted)); + if (!ted_open_file(ted, starting_filename)) { + char err[512] = {0}; + sprintf(err, "%.500s", ted_geterr(ted)); // -Wrestrict (rightly) complains without this intermediate step + ted_seterr(ted, "Couldn't load file: %s", err); + } } else { - if (!ted_new_file(ted, starting_filename)) - ted_seterr(ted, "Couldn't create file: %s", ted_geterr(ted)); + if (!ted_new_file(ted, starting_filename)) { + char err[512] = {0}; + sprintf(err, "%.500s", ted_geterr(ted)); + ted_seterr(ted, "Couldn't create file: %s", err); + } } } else { session_read(ted); |