Commit | Line | Data |
---|---|---|
8e68d1c8 | 1 | /* |
996b65c8 | 2 | * Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca> |
1e307fab | 3 | * Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
8e68d1c8 | 4 | * |
d14d33bf AM |
5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License, version 2 only, | |
7 | * as published by the Free Software Foundation. | |
8e68d1c8 | 8 | * |
d14d33bf AM |
9 | * This program is distributed in the hope that it will be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
8e68d1c8 | 13 | * |
d14d33bf AM |
14 | * You should have received a copy of the GNU General Public License along |
15 | * with this program; if not, write to the Free Software Foundation, Inc., | |
16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
8e68d1c8 DG |
17 | */ |
18 | ||
19 | #define _GNU_SOURCE | |
8e68d1c8 | 20 | #include <stdlib.h> |
8e68d1c8 DG |
21 | #include <unistd.h> |
22 | ||
db758600 | 23 | #include <common/error.h> |
7272acf5 | 24 | |
8e68d1c8 DG |
25 | #include "utils.h" |
26 | ||
54d01ffb DG |
27 | /* |
28 | * Write to writable pipe used to notify a thread. | |
29 | */ | |
30 | int notify_thread_pipe(int wpipe) | |
31 | { | |
32 | int ret; | |
33 | ||
6f94560a MD |
34 | do { |
35 | ret = write(wpipe, "!", 1); | |
36 | } while (ret < 0 && errno == EINTR); | |
54d01ffb | 37 | if (ret < 0) { |
7272acf5 | 38 | PERROR("write poll pipe"); |
54d01ffb DG |
39 | } |
40 | ||
41 | return ret; | |
42 | } | |
43 | ||
b082db07 | 44 | /* |
050349bb | 45 | * Return pointer to home directory path using the env variable HOME. |
b082db07 | 46 | * |
050349bb | 47 | * No home, NULL is returned. |
b082db07 DG |
48 | */ |
49 | const char *get_home_dir(void) | |
50 | { | |
51 | return ((const char *) getenv("HOME")); | |
52 | } |