On 5/29/18 5:06 PM, Luis R. Rodriguez wrote:
+/* + * If the file is not found -1 is returned and errno set. Otherwise + * the file descriptor is returned. + */ +int +open_cli_config( + char *cli_config_file, + char **fpath) +{ + int fd, len; + char *final_path = NULL; + char *relative_path= NULL; + unsigned int i; + + if (strlen(cli_config_file) > 2) { + if (cli_config_file[0] == '.' && cli_config_file[1] == '/') + final_path = cli_config_file; + else if (cli_config_file[0] == '.' && cli_config_file[1] == '.') + final_path = cli_config_file; + else if (cli_config_file[0] == '/') + final_path = cli_config_file; + else + relative_path = cli_config_file; + } else if (strlen(cli_config_file) == 1) { + if (cli_config_file[0] == '.' || cli_config_file[0] == '/') { + errno = EINVAL; + return -1; + } else + relative_path = cli_config_file; + }
so you have 2 cases, strlen > 2 and strlen == 1. What about == 2? # ls /a /a # mkfs/mkfs.xfs -c /a /dev/sdb1 Error parsing command line config file: /a : No such device or address so that looks like a bug here. -Eric -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html