mirror of
https://github.com/transmission/transmission.git
synced 2026-05-08 09:39:08 +01:00
Handle potential dirname/basename errors where needed
This commit is contained in:
+8
-1
@@ -156,7 +156,14 @@ tr_main (int argc,
|
||||
|
||||
if (outfile == NULL)
|
||||
{
|
||||
char * base = tr_sys_path_basename (infile, NULL);
|
||||
tr_error * error = NULL;
|
||||
char * base = tr_sys_path_basename (infile, &error);
|
||||
if (base == NULL)
|
||||
{
|
||||
fprintf (stderr, "ERROR: Cannot deduce output path from input path: %s\n", error->message);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
char * end = tr_strdup_printf ("%s.torrent", base);
|
||||
char * cwd = tr_getcwd ();
|
||||
outfile = out2 = tr_buildPath (cwd, end, NULL);
|
||||
|
||||
Reference in New Issue
Block a user