chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Prep v225: Applying various fixes and changes to src/libelogind/sd-bus that got lost...
[elogind.git]
/
src
/
basic
/
terminal-util.c
diff --git
a/src/basic/terminal-util.c
b/src/basic/terminal-util.c
index 43510f481dfa359cb9e6464555ea1ea10471117d..73e5c2e571b681233dfc5135bf5616fd7903d280 100644
(file)
--- a/
src/basic/terminal-util.c
+++ b/
src/basic/terminal-util.c
@@
-233,14
+233,14
@@
int reset_terminal_fd(int fd, bool switch_to_text) {
* interfere with that. */
/* Disable exclusive mode, just in case */
* interfere with that. */
/* Disable exclusive mode, just in case */
- ioctl(fd, TIOCNXCL);
+
(void)
ioctl(fd, TIOCNXCL);
/* Switch to text mode */
if (switch_to_text)
/* Switch to text mode */
if (switch_to_text)
- ioctl(fd, KDSETMODE, KD_TEXT);
+
(void)
ioctl(fd, KDSETMODE, KD_TEXT);
/* Enable console unicode mode */
/* Enable console unicode mode */
- ioctl(fd, KDSKBMODE, K_UNICODE);
+
(void)
ioctl(fd, KDSKBMODE, K_UNICODE);
if (tcgetattr(fd, &termios) < 0) {
r = -errno;
if (tcgetattr(fd, &termios) < 0) {
r = -errno;
@@
-279,7
+279,7
@@
int reset_terminal_fd(int fd, bool switch_to_text) {
finish:
/* Just in case, flush all crap out */
finish:
/* Just in case, flush all crap out */
- tcflush(fd, TCIOFLUSH);
+
(void)
tcflush(fd, TCIOFLUSH);
return r;
}
return r;
}
@@
-311,7
+311,8
@@
int open_terminal(const char *name, int mode) {
* https://bugs.launchpad.net/ubuntu/+source/linux/+bug/554172/comments/245
*/
* https://bugs.launchpad.net/ubuntu/+source/linux/+bug/554172/comments/245
*/
- assert(!(mode & O_CREAT));
+ if (mode & O_CREAT)
+ return -EINVAL;
for (;;) {
fd = open(name, mode, 0);
for (;;) {
fd = open(name, mode, 0);
@@
-420,9
+421,8
@@
int acquire_terminal(
if (r < 0 && r == -EPERM && ignore_tiocstty_eperm)
r = 0;
if (r < 0 && r == -EPERM && ignore_tiocstty_eperm)
r = 0;
- if (r < 0 && (force || fail || r != -EPERM))
{
+ if (r < 0 && (force || fail || r != -EPERM))
goto fail;
goto fail;
- }
if (r >= 0)
break;
if (r >= 0)
break;
@@
-622,16
+622,16
@@
void warn_melody(void) {
/* Yeah, this is synchronous. Kinda sucks. But well... */
/* Yeah, this is synchronous. Kinda sucks. But well... */
- ioctl(fd, KIOCSOUND, (int)(1193180/440));
+
(void)
ioctl(fd, KIOCSOUND, (int)(1193180/440));
usleep(125*USEC_PER_MSEC);
usleep(125*USEC_PER_MSEC);
- ioctl(fd, KIOCSOUND, (int)(1193180/220));
+
(void)
ioctl(fd, KIOCSOUND, (int)(1193180/220));
usleep(125*USEC_PER_MSEC);
usleep(125*USEC_PER_MSEC);
- ioctl(fd, KIOCSOUND, (int)(1193180/220));
+
(void)
ioctl(fd, KIOCSOUND, (int)(1193180/220));
usleep(125*USEC_PER_MSEC);
usleep(125*USEC_PER_MSEC);
- ioctl(fd, KIOCSOUND, 0);
+
(void)
ioctl(fd, KIOCSOUND, 0);
}
/// UNNEEDED by elogind
}
/// UNNEEDED by elogind