Magellan Linux

Diff of /trunk/mkinitrd-magellan/busybox/debianutils/mktemp.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 816 by niro, Fri Apr 24 18:33:46 2009 UTC revision 1123 by niro, Wed Aug 18 21:56:57 2010 UTC
# Line 39  int mktemp_main(int argc UNUSED_PARAM, c Line 39  int mktemp_main(int argc UNUSED_PARAM, c
39  {  {
40   const char *path;   const char *path;
41   char *chp;   char *chp;
42   unsigned opt;   unsigned opts;
43    
44     path = getenv("TMPDIR");
45     if (!path || path[0] == '\0')
46     path = "/tmp";
47    
48     /* -q and -t are ignored */
49   opt_complementary = "?1"; /* 1 argument max */   opt_complementary = "?1"; /* 1 argument max */
50   opt = getopt32(argv, "dqtp:", &path);   opts = getopt32(argv, "dqtp:", &path);
  chp = argv[optind] ? argv[optind] : xstrdup("tmp.XXXXXX");  
51    
52   if (opt & (4|8)) { /* -t and/or -p */   chp = argv[optind] ? argv[optind] : xstrdup("tmp.XXXXXX");
53   const char *dir = getenv("TMPDIR");   if (chp[0] != '/' || (opts & 8))
  if (dir && *dir != '\0')  
  path = dir;  
  else if (!(opt & 8)) /* no -p */  
  path = "/tmp/";  
  /* else path comes from -p DIR */  
54   chp = concat_path_file(path, chp);   chp = concat_path_file(path, chp);
  }  
55    
56   if (opt & 1) { /* -d */   if (opts & 1) { /* -d */
57   if (mkdtemp(chp) == NULL)   if (mkdtemp(chp) == NULL)
58   return EXIT_FAILURE;   return EXIT_FAILURE;
59   } else {   } else {

Legend:
Removed from v.816  
changed lines
  Added in v.1123