# HG changeset patch # User Matti Hamalainen # Date 1529855595 -10800 # Node ID 1e8f60ce21d185f67a907a79b5cc47cd042eea38 # Parent 1067df067f284e3628cf61f3d0edc391a4e18f94 Add check for writability in output format option -f diff -r 1067df067f28 -r 1e8f60ce21d1 tools/gfxconv.c --- a/tools/gfxconv.c Sun Jun 24 18:45:33 2018 +0300 +++ b/tools/gfxconv.c Sun Jun 24 18:53:15 2018 +0300 @@ -585,7 +585,7 @@ dmGetConvFormat(optInFormat, optForcedInSubFormat, &fmt); if ((fmt.flags & DM_FMT_RD) == 0) { - dmErrorMsg("Invalid input format '%s'.\n", + dmErrorMsg("Invalid input format '%s', does not support reading.\n", fmt.name); return FALSE; } @@ -605,8 +605,20 @@ break; case 5: - if (!dmParseFormatOption("output", "Output", optArg, &optOutFormat, &optOutSubFormat)) - return FALSE; + { + DMConvFormat fmt; + + if (!dmParseFormatOption("output", "Output", optArg, &optOutFormat, &optOutSubFormat)) + return FALSE; + + dmGetConvFormat(optOutFormat, optOutSubFormat, &fmt); + if ((fmt.flags & DM_FMT_WR) == 0) + { + dmErrorMsg("Invalid output format '%s', does not support writing.\n", + fmt.name); + return FALSE; + } + } break; case 6: