Ignore:
Timestamp:
Nov 4, 2007, 3:16:40 AM (17 years ago)
Author:
Bruno Cornec
Message:

Update to busybox 1.7.2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.5/mindi-busybox/debianutils/mktemp.c

    r821 r1765  
    1010 */
    1111
    12 #include "busybox.h"
    13 #include <stdio.h>
    14 #include <errno.h>
    15 #include <string.h>
    16 #include <unistd.h>
    17 #include <stdlib.h>
     12#include "libbb.h"
    1813
     14int mktemp_main(int argc, char **argv);
    1915int mktemp_main(int argc, char **argv)
    2016{
    21     unsigned long flags = bb_getopt_ulflags(argc, argv, "dq");
     17    unsigned long flags = getopt32(argv, "dqt");
     18    char *chp;
    2219
    2320    if (optind + 1 != argc)
    2421        bb_show_usage();
    2522
     23    chp = argv[optind];
     24
     25    if (flags & 4) {
     26        char *dir = getenv("TMPDIR");
     27        if (dir && *dir != '\0')
     28            chp = concat_path_file(dir, chp);
     29        else
     30            chp = concat_path_file("/tmp/", chp);
     31    }
     32
    2633    if (flags & 1) {
    27         if (mkdtemp(argv[optind]) == NULL)
     34        if (mkdtemp(chp) == NULL)
    2835            return EXIT_FAILURE;
    29     }
    30     else {
    31         if (mkstemp(argv[optind]) < 0)
     36    } else {
     37        if (mkstemp(chp) < 0)
    3238            return EXIT_FAILURE;
    3339    }
    3440
    35     puts(argv[optind]);
     41    puts(chp);
    3642
    3743    return EXIT_SUCCESS;
Note: See TracChangeset for help on using the changeset viewer.