diff options
Diffstat (limited to 'src/utils/lib/pty-session.c')
-rw-r--r-- | src/utils/lib/pty-session.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/utils/lib/pty-session.c b/src/utils/lib/pty-session.c index f4bb004..6f038e1 100644 --- a/src/utils/lib/pty-session.c +++ b/src/utils/lib/pty-session.c @@ -18,6 +18,7 @@ #include <paths.h> #include <sys/types.h> #include <sys/wait.h> +#include <inttypes.h> #include "c.h" #include "all-io.h" @@ -129,7 +130,8 @@ void ul_pty_set_mainloop_time(struct ul_pty *pty, struct timeval *tv) } else { pty->next_callback_time.tv_sec = tv->tv_sec; pty->next_callback_time.tv_usec = tv->tv_usec; - DBG(IO, ul_debugobj(pty, "mainloop time: %ld.%06ld", tv->tv_sec, tv->tv_usec)); + DBG(IO, ul_debugobj(pty, "mainloop time: %"PRId64".%06"PRId64, + (int64_t) tv->tv_sec, (int64_t) tv->tv_usec)); } } @@ -239,6 +241,15 @@ void ul_pty_cleanup(struct ul_pty *pty) tcsetattr(STDIN_FILENO, TCSADRAIN, &rtt); } +int ul_pty_chownmod_slave(struct ul_pty *pty, uid_t uid, gid_t gid, mode_t mode) +{ + if (fchown(pty->slave, uid, gid)) + return -errno; + if (fchmod(pty->slave, mode)) + return -errno; + return 0; +} + /* call me in child process */ void ul_pty_init_slave(struct ul_pty *pty) { |