X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Futil.c;h=0b0063ee0e6078a48cdec42f053be97c42a7742a;hb=40b3203173ad78fdb5ceb257b08a93a587102518;hp=bc227f52d59e4ff7269f5716d8d2b2df8c806a7c;hpb=f61448083198dc0e4e0d19a916bcd478336cc85d;p=elogind.git diff --git a/src/util.c b/src/util.c index bc227f52d..0b0063ee0 100644 --- a/src/util.c +++ b/src/util.c @@ -2531,11 +2531,12 @@ char* getlogname_malloc(void) { int getttyname_malloc(char **r) { char path[PATH_MAX], *p, *c; + int k; assert(r); - if (ttyname_r(STDIN_FILENO, path, sizeof(path)) < 0) - return -errno; + if ((k = ttyname_r(STDIN_FILENO, path, sizeof(path))) != 0) + return -k; char_array_0(path); @@ -2980,23 +2981,6 @@ char *ellipsize(const char *s, unsigned length, unsigned percent) { return r; } -void nss_disable_nscd(void) { - - void (*func)(void); - - /* This is an internal glibc function call. We are not - * supposed to call this, because we are not nscd. However - * sometimes we feel really dangerous and do it - * nonetheless. Muahahah! But at least we protect this with a - * dlsym() just in case glibc takes this away from us. */ - - if ((func = dlsym(RTLD_DEFAULT, "__nss_disable_nscd"))) { - log_debug("Disabling nscd."); - func(); - } else - log_debug("Cannot disable nscd."); -} - int touch(const char *path) { int fd;