gnash-dev
[Top][All Lists]
Advanced

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

[Gnash-dev] [PATCH] User-specific tmp directory and auto-removal of swf


From: Takashi Iwai
Subject: [Gnash-dev] [PATCH] User-specific tmp directory and auto-removal of swf files
Date: Wed, 23 Aug 2006 14:07:24 +0200
User-agent: Wanderlust/2.12.0 (Your Wildest Dreams) SEMI/1.14.6 (Maruoka) FLIM/1.14.7 (Sanjō) APEL/10.6 MULE XEmacs/21.5 (beta25) (eggplant) (+CVS-20060326) (i386-suse-linux)

Hi,

the patch below adds the following features to gnash plugin:

- Create user-specific tmp directory (/tmp/gnashtmp-$USER) and put the
  downloaded swf files there.

- Automatically remove swf file at closing

The user-specific tmp is good for privacy since the directory is
accessible only for the user.  The auto-removal is for lazy people
like me who don't clean up tmp regularly.


Takashi

--- plugin/plugin.cpp-dist      2006-08-16 14:40:30.000000000 +0200
+++ plugin/plugin.cpp   2006-08-16 17:34:54.000000000 +0200
@@ -357,6 +357,7 @@
     }
 
     _childpid = 0;
+    unlink(_swf_file.c_str());
 }
 
 /// \brief Set the window to be used to render in
@@ -442,7 +443,17 @@
 
     end   = url.find(".swf", 0) + 4;
     start = url.rfind("/", end) + 1;
-    fname = "/tmp/";
+    fname = "/tmp/gnashtmp-";
+    if (getlogin())
+           fname += getlogin();
+    if (access(fname.c_str(), R_OK|W_OK|X_OK)) {
+       if (mkdir(fname.c_str(), S_IRWXU)) {
+           WriteStatus(string("Can't create a temporary directory: ") + fname);
+           dbglogfile << "ERROR: Can't create a temporary directory: " << 
fname << endl;
+           return NPERR_INVALID_PARAM;
+       }
+    }
+    fname += "/";
     fname += url.substr(start, end - start);
 
     // extract the parameters from the URL




reply via email to

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