]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Merge branch 'master' into next
authorAndre Noll <maan@systemlinux.org>
Sun, 19 Jul 2009 12:16:56 +0000 (14:16 +0200)
committerAndre Noll <maan@systemlinux.org>
Sun, 19 Jul 2009 12:16:56 +0000 (14:16 +0200)
1  2 
alsa_write.c
file_write.c
oss_write.c

diff --combined alsa_write.c
index 3c7c03b467cb9e40a13e1d348a93600c0fdd51b3,1e44609383d2e57b357a92cc780d162233075a4a..ae8bed6d339724563e86eb899d9aa96a46f6f8e7
@@@ -12,7 -12,6 +12,7 @@@
   * based on the vplay program by Michael Beck.
   */
  
 +#include <regex.h>
  #include <sys/types.h>
  #include <dirent.h>
  #include <alsa/asoundlib.h>
@@@ -264,4 -263,5 +264,5 @@@ void alsa_write_init(struct writer *w
                .short_help = alsa_write_args_info_help,
                .detailed_help = alsa_write_args_info_detailed_help
        };
+       alsa_cmdline_parser_free(&dummy);
  }
diff --combined file_write.c
index 3286ea87a089363036cabe518a98ef16151e12ca,e03cf8f65acea814d5dc62a9e450b056527b06f4..9a4f0707f6f213f1fc88346b0aa2c039bebfa003
@@@ -6,10 -6,8 +6,10 @@@
  
  /** \file file_write.c simple output plugin for testing purposes */
  
 +#include <regex.h>
  #include <sys/types.h>
  #include <dirent.h>
 +#include <sys/time.h>
  
  #include "para.h"
  #include "list.h"
@@@ -29,37 -27,20 +29,37 @@@ struct private_file_write_data 
        int check_fd;
  };
  
 +/*
 + * Get a random filename.
 + *
 + * This is by no means a secure way to create temporary files in a hostile
 + * directory like \p /tmp. However, we use it only for creating temp files in
 + * ~/.paraslash, for which it is OK. Result must be freed by the caller.
 + */
 +__must_check __malloc static char *random_filename(void)
 +{
 +      char *result, *home = para_homedir();
 +      struct timeval tv;
 +
 +      gettimeofday(&tv, NULL);
 +      srandom(tv.tv_usec);
 +      result = make_message("%s/.paraslash/%08lu", home,
 +              para_random(99999999));
 +      free(home);
 +      return result;
 +}
 +
  static int file_write_open(struct writer_node *wn)
  {
        struct private_file_write_data *pfwd = para_calloc(
                sizeof(struct private_file_write_data));
        struct file_write_args_info *conf = wn->conf;
        char *filename;
 +
        if (conf->filename_given)
                filename = conf->filename_arg;
 -      else {
 -              char *tmp = para_tmpname(), *home = para_homedir();
 -              filename = make_message("%s/.paraslash/%s", home, tmp);
 -              free(home);
 -              free(tmp);
 -      }
 +      else
 +              filename = random_filename();
        wn->private_data = pfwd;
        pfwd->fd = open(filename, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
        if (!conf->filename_given)
@@@ -142,4 -123,5 +142,5 @@@ void file_write_init(struct writer *w
                .short_help = file_write_args_info_help,
                .detailed_help = file_write_args_info_detailed_help
        };
+       file_cmdline_parser_free(&dummy);
  }
diff --combined oss_write.c
index 103b14ea5fa16c68feeb10302454e41570673dc7,6a55005ec8247a46c424ebabe9308e03f03c1d24..9ec85560d29ebef00f269a95ca2fda49e9c427d1
@@@ -6,7 -6,6 +6,7 @@@
  
  /** \file oss_write.c Paraslash's oss output plugin. */
  
 +#include <regex.h>
  #include <sys/ioctl.h>
  #include <fcntl.h>
  #include <dirent.h>
@@@ -217,4 -216,5 +217,5 @@@ void oss_write_init(struct writer *w
                .short_help = oss_write_args_info_help,
                .detailed_help = oss_write_args_info_detailed_help
        };
+       oss_cmdline_parser_free(&dummy);
  }