Browse Source

Fix outdir handling

tags/v1.0
Bernhard Fröhlich 5 years ago
parent
commit
cf512440a4
1 changed files with 4 additions and 3 deletions
  1. 4
    3
      drmdecrypt.c

+ 4
- 3
drmdecrypt.c View File

@@ -276,7 +276,7 @@ int main(int argc, char *argv[])
276 276
    char inffile[PATH_MAX];
277 277
    char srffile[PATH_MAX];
278 278
    char outfile[PATH_MAX];
279
-   char outdir[PATH_MAX] = ".";
279
+   char outdir[PATH_MAX];
280 280
    FILE *srffp, *outfp;
281 281
    int ch, retries;
282 282
 
@@ -288,6 +288,7 @@ int main(int argc, char *argv[])
288 288
 
289 289
    memset(inffile, '\0', sizeof(inffile));
290 290
    memset(outfile, '\0', sizeof(outfile));
291
+   memset(outdir, '\0', sizeof(outdir));
291 292
 
292 293
    enable_aesni = Check_CPU_support_AES();
293 294
 
@@ -328,12 +329,12 @@ int main(int argc, char *argv[])
328 329
       return 1;
329 330
 
330 331
    /* verify outdir */
332
+   strcpy(outdir, dirname(srffile));
331 333
    if(outdir[strlen(outdir)-1] != '/')
332 334
       strcat(outdir, "/");
333 335
 
334
-   strcpy(outfile, outdir);
335
-
336 336
    /* generate outfile name based on title from .inf file */
337
+   strcpy(outfile, outdir);
337 338
    if(genoutfilename(outfile, inffile) != 0)
338 339
    {
339 340
       strcat(outfile, srffile);

Loading…
Cancel
Save