/[path-sandbox]/trunk/libsbutil/get_tmp_dir.c
Gentoo

Contents of /trunk/libsbutil/get_tmp_dir.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 340 - (show annotations) (download) (as text)
Thu Jul 13 15:41:48 2006 UTC (8 years, 5 months ago) by azarah
File MIME type: text/x-csrc
File size: 1275 byte(s)
Split out util functions.

1 /*
2 * get_tmp_dir.c
3 *
4 * Util functions.
5 *
6 * Copyright 1999-2006 Gentoo Foundation
7 *
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation version 2 of the License.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 * Some parts might have Copyright:
23 *
24 * Copyright (C) 2002 Brad House <brad@mainstreetsoftworks.com>
25 *
26 * $Header$
27 */
28
29
30 #include <errno.h>
31 #include <limits.h>
32 #include <stdlib.h>
33
34 #include "sbutil.h"
35
36 int get_tmp_dir(char *path)
37 {
38 save_errno();
39
40 if (NULL == realpath(getenv(ENV_TMPDIR) ? getenv(ENV_TMPDIR)
41 : TMPDIR,
42 path)) {
43 if (NULL == realpath(TMPDIR, path))
44 return -1;
45 }
46
47 /* Reset errno in case realpath set it */
48 restore_errno();
49
50 return 0;
51 }

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.20