gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash/testsuite/misc-ming.all streamingSoundTes...


From: Sandro Santilli
Subject: [Gnash-commit] gnash/testsuite/misc-ming.all streamingSoundTes...
Date: Wed, 26 Mar 2008 15:51:36 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  08/03/26 15:51:36

Modified files:
        testsuite/misc-ming.all: streamingSoundTest1.c 

Log message:
        warn if passed a dir rather then a file

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/streamingSoundTest1.c?cvsroot=gnash&r1=1.1&r2=1.2

Patches:
Index: streamingSoundTest1.c
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/streamingSoundTest1.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- streamingSoundTest1.c       19 Mar 2008 21:24:39 -0000      1.1
+++ streamingSoundTest1.c       26 Mar 2008 15:51:36 -0000      1.2
@@ -24,6 +24,10 @@
 
 #include <stdlib.h>
 #include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
 #include <ming.h>
 
 #include "ming_utils.h"
@@ -41,6 +45,7 @@
   FILE* sound_f;
   const char* sound_filename;
   SWFDisplayItem it;
+  struct stat statbuf;
 
   if ( argc>1 ) {
     sound_filename=argv[1];
@@ -51,7 +56,18 @@
   sound_f = fopen(sound_filename, "r");
   if ( ! sound_f ) {
     perror(sound_filename);
-    return 1;
+    return EXIT_FAILURE;
+  }
+
+  if ( -1 == fstat(fileno(sound_f), &statbuf) )
+  {
+    perror("fstat");
+    return EXIT_FAILURE;
+  }
+  if ( S_ISDIR(statbuf.st_mode) )
+  {
+    fprintf(stderr, "%s is a directory, we need a file\n", sound_filename);
+    return EXIT_FAILURE;
   }
 
   Ming_init();
@@ -74,5 +90,5 @@
   puts("Saving " OUTPUT_FILENAME );
   SWFMovie_save(mo, OUTPUT_FILENAME);
 
-  return 0;
+  return EXIT_SUCCESS;
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]