aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/blogc/funcvars.c5
-rw-r--r--src/blogc/sysinfo.c19
-rw-r--r--src/blogc/sysinfo.h8
3 files changed, 2 insertions, 30 deletions
diff --git a/src/blogc/funcvars.c b/src/blogc/funcvars.c
index 42411e2..6f0700b 100644
--- a/src/blogc/funcvars.c
+++ b/src/blogc/funcvars.c
@@ -30,14 +30,11 @@ static const struct func_map {
{"BLOGC_SYSINFO_HOSTNAME", blogc_sysinfo_inject_hostname},
#endif
-#ifdef HAVE_SYSINFO_USERNAME
- {"BLOGC_SYSINFO_USERNAME", blogc_sysinfo_inject_username},
-#endif
-
#ifdef HAVE_SYSINFO_DATETIME
{"BLOGC_SYSINFO_DATETIME", blogc_sysinfo_inject_datetime},
#endif
+ {"BLOGC_SYSINFO_USERNAME", blogc_sysinfo_inject_username},
{"BLOGC_SYSINFO_INSIDE_DOCKER", blogc_sysinfo_inject_inside_docker},
{NULL, NULL},
};
diff --git a/src/blogc/sysinfo.c b/src/blogc/sysinfo.c
index 4ec1411..cdb860e 100644
--- a/src/blogc/sysinfo.c
+++ b/src/blogc/sysinfo.c
@@ -14,14 +14,6 @@
#include <unistd.h>
#endif /* HAVE_UNISTD_H */
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif /* HAVE_SYS_TYPES_H */
-
-#ifdef HAVE_PWD_H
-#include <pwd.h>
-#endif /* HAVE_PWD_H */
-
#ifdef HAVE_TIME_H
#include <time.h>
#endif /* HAVE_TIME_H */
@@ -66,16 +58,7 @@ blogc_sysinfo_inject_hostname(bc_trie_t *global)
char*
blogc_sysinfo_get_username(void)
{
-#ifndef HAVE_SYSINFO_USERNAME
- return NULL;
-#else
- uid_t u = geteuid();
- struct passwd *p = getpwuid(u);
- if (p == NULL)
- return NULL;
-
- return bc_strdup(p->pw_name);
-#endif
+ return bc_strdup(getenv("LOGNAME"));
}
diff --git a/src/blogc/sysinfo.h b/src/blogc/sysinfo.h
index 783b656..b249661 100644
--- a/src/blogc/sysinfo.h
+++ b/src/blogc/sysinfo.h
@@ -19,14 +19,6 @@
#endif /* HAVE_GETHOSTNAME */
#endif /* HAVE_UNISTD_H */
-#ifdef HAVE_UNISTD_H
-#ifdef HAVE_SYS_TYPES_H
-#ifdef HAVE_PWD_H
-#define HAVE_SYSINFO_USERNAME 1
-#endif /* HAVE_PWD_H */
-#endif /* HAVE_SYS_TYPES_H */
-#endif /* HAVE_UNISTD_H */
-
#ifdef HAVE_TIME_H
#define HAVE_SYSINFO_DATETIME 1
#endif /* HAVE_TIME_H */