diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2010-09-14 12:56:34 +1000 |
---|---|---|
committer | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2010-09-14 12:56:34 +1000 |
commit | c31744ca1a86b2276c37c6d9a884660185debed6 (patch) | |
tree | bb051c35c3430a3793ceef173a01cb522fb4ae05 /debianutils | |
parent | 1a286d510c2125bdab601ce47afd4d27b6ce6f41 (diff) | |
parent | e329089c62ed813e97344f8c61d7dc34221fd5ee (diff) | |
download | busybox-w32-c31744ca1a86b2276c37c6d9a884660185debed6.tar.gz busybox-w32-c31744ca1a86b2276c37c6d9a884660185debed6.tar.bz2 busybox-w32-c31744ca1a86b2276c37c6d9a884660185debed6.zip |
Merge branch 'origin/master' (early part)
Diffstat (limited to 'debianutils')
-rw-r--r-- | debianutils/Config.src | 2 | ||||
-rw-r--r-- | debianutils/Kbuild.src | 2 | ||||
-rw-r--r-- | debianutils/mktemp.c | 23 |
3 files changed, 14 insertions, 13 deletions
diff --git a/debianutils/Config.src b/debianutils/Config.src index 9bce0498c..838d8f00c 100644 --- a/debianutils/Config.src +++ b/debianutils/Config.src | |||
@@ -5,6 +5,8 @@ | |||
5 | 5 | ||
6 | menu "Debian Utilities" | 6 | menu "Debian Utilities" |
7 | 7 | ||
8 | INSERT | ||
9 | |||
8 | config MKTEMP | 10 | config MKTEMP |
9 | bool "mktemp" | 11 | bool "mktemp" |
10 | default y | 12 | default y |
diff --git a/debianutils/Kbuild.src b/debianutils/Kbuild.src index bcf6126ad..da34e4e4f 100644 --- a/debianutils/Kbuild.src +++ b/debianutils/Kbuild.src | |||
@@ -5,6 +5,8 @@ | |||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | 5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. |
6 | 6 | ||
7 | lib-y:= | 7 | lib-y:= |
8 | |||
9 | INSERT | ||
8 | lib-$(CONFIG_MKTEMP) += mktemp.o | 10 | lib-$(CONFIG_MKTEMP) += mktemp.o |
9 | lib-$(CONFIG_PIPE_PROGRESS) += pipe_progress.o | 11 | lib-$(CONFIG_PIPE_PROGRESS) += pipe_progress.o |
10 | lib-$(CONFIG_RUN_PARTS) += run_parts.o | 12 | lib-$(CONFIG_RUN_PARTS) += run_parts.o |
diff --git a/debianutils/mktemp.c b/debianutils/mktemp.c index 0dcb1e826..c40211476 100644 --- a/debianutils/mktemp.c +++ b/debianutils/mktemp.c | |||
@@ -39,23 +39,20 @@ int mktemp_main(int argc UNUSED_PARAM, char **argv) | |||
39 | { | 39 | { |
40 | const char *path; | 40 | const char *path; |
41 | char *chp; | 41 | char *chp; |
42 | unsigned opt; | 42 | unsigned opts; |
43 | 43 | ||
44 | path = getenv("TMPDIR"); | ||
45 | if (!path || path[0] == '\0') | ||
46 | path = "/tmp"; | ||
47 | |||
48 | /* -q and -t are ignored */ | ||
44 | opt_complementary = "?1"; /* 1 argument max */ | 49 | opt_complementary = "?1"; /* 1 argument max */ |
45 | opt = getopt32(argv, "dqtp:", &path); | 50 | opts = getopt32(argv, "dqtp:", &path); |
46 | chp = argv[optind] ? argv[optind] : xstrdup("tmp.XXXXXX"); | ||
47 | 51 | ||
48 | if (opt & (4|8)) { /* -t and/or -p */ | 52 | chp = argv[optind] ? argv[optind] : xstrdup("tmp.XXXXXX"); |
49 | const char *dir = getenv("TMPDIR"); | 53 | chp = concat_path_file(path, chp); |
50 | if (dir && *dir != '\0') | ||
51 | path = dir; | ||
52 | else if (!(opt & 8)) /* no -p */ | ||
53 | path = "/tmp/"; | ||
54 | /* else path comes from -p DIR */ | ||
55 | chp = concat_path_file(path, chp); | ||
56 | } | ||
57 | 54 | ||
58 | if (opt & 1) { /* -d */ | 55 | if (opts & 1) { /* -d */ |
59 | if (mkdtemp(chp) == NULL) | 56 | if (mkdtemp(chp) == NULL) |
60 | return EXIT_FAILURE; | 57 | return EXIT_FAILURE; |
61 | } else { | 58 | } else { |