summaryrefslogtreecommitdiff
path: root/src/libudev/util.c
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2013-06-04 12:53:32 -0400
committerAnthony G. Basile <blueness@gentoo.org>2013-06-04 12:53:32 -0400
commit6ca44589b07c2a809718c4a630005b999f53d58d (patch)
tree7a67c0c8237f8595d900e690f69cca8851e2dffd /src/libudev/util.c
parentfcb3dc92650f0ab01816f258b5e521b5daab29a3 (diff)
src/libudev/strv.{c,h}: bring in line with upstream
In doing so, we better alined util.{c,h} by movig the definitions of freep, fclosep, closep, closedirp, umaskp from util.c to util.h as static inline. We also add strv_env_get to env-util.{c,h} which we forgot to do earlier. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/libudev/util.c')
-rw-r--r--src/libudev/util.c70
1 files changed, 0 insertions, 70 deletions
diff --git a/src/libudev/util.c b/src/libudev/util.c
index b93b5c1b68..09c7033274 100644
--- a/src/libudev/util.c
+++ b/src/libudev/util.c
@@ -5948,76 +5948,6 @@ int get_home_dir(char **_h) {
return 0;
}
-int get_shell(char **_sh) {
- char *sh;
- const char *e;
- uid_t u;
- struct passwd *p;
-
- assert(_sh);
-
- /* Take the user specified one */
- e = getenv("SHELL");
- if (e) {
- sh = strdup(e);
- if (!sh)
- return -ENOMEM;
-
- *_sh = sh;
- return 0;
- }
-
- /* Hardcode home directory for root to avoid NSS */
- u = getuid();
- if (u == 0) {
- sh = strdup("/bin/sh");
- if (!sh)
- return -ENOMEM;
-
- *_sh = sh;
- return 0;
- }
-
- /* Check the database... */
- errno = 0;
- p = getpwuid(u);
- if (!p)
- return errno ? -errno : -ESRCH;
-
- if (!path_is_absolute(p->pw_shell))
- return -EINVAL;
-
- sh = strdup(p->pw_shell);
- if (!sh)
- return -ENOMEM;
-
- *_sh = sh;
- return 0;
-}
-
-void freep(void *p) {
- free(*(void**) p);
-}
-
-void fclosep(FILE **f) {
- if (*f)
- fclose(*f);
-}
-
-void closep(int *fd) {
- if (*fd >= 0)
- close_nointr_nofail(*fd);
-}
-
-void closedirp(DIR **d) {
- if (*d)
- closedir(*d);
-}
-
-void umaskp(mode_t *u) {
- umask(*u);
-}
-
bool filename_is_safe(const char *p) {
if (isempty(p))