[vdr] vdr 1.3.38: SVDRP grab filename

Stefan Huelswitt s.huelswitt at gmx.de
Mon Jan 9 19:20:21 CET 2006


Hi,

as far as I see, the new SVDRP grab code always prepends the
given filename with the grabdirectory (given with -g) even if the
filename in the grab command is actualy a full path.

Is this change intended?

I yes, may be this should be documented somewhere, as it's not
backward compatible with older vdr versions.
But I don't see a reason why it's necessary. The path check later
will catch a wrong path anyways.

I'd suggested something like (defaulting to jpeg with no filename
extention for enhanced backward compatibility too):

--- svdrp.c.orig	2005-12-30 16:42:29.000000000 +0100
+++ svdrp.c	2006-01-09 19:15:51.000000000 +0100
@@ -682,8 +682,7 @@
      else if (strcmp(FileName, "-") == 0)
         FileName = NULL;
      else {
-        Reply(501, "Missing filename extension in \"%s\"", FileName);
-        return;
+        Jpeg = true;
         }
      // image quality (and obsolete type):
      if ((p = strtok_r(NULL, delim, &strtok_next)) != NULL) {
@@ -729,10 +728,13 @@
      char RealFileName[PATH_MAX];
      if (FileName) {
         if (grabImageDir) {
-           char *s;
-           asprintf(&s, "%s/%s", grabImageDir, FileName);
-           FileName = s;
-           char *slash = strrchr(FileName, '/'); // there definitely is one
+           char *s = 0;
+           char *slash = strrchr(FileName, '/');
+           if (!slash) {
+              asprintf(&s, "%s/%s", grabImageDir, FileName);
+              FileName = s;
+              }
+           slash = strrchr(FileName, '/'); // there definitely is one
            *slash = 0;
            char *r = realpath(FileName, RealFileName);
            *slash = '/';

Regards.

-- 
Stefan Huelswitt
s.huelswitt at gmx.de  | http://www.muempf.de/



More information about the vdr mailing list