From c89769ac824f99ec4114a789331f0137b202b769 Mon Sep 17 00:00:00 2001
From: Carl Drougge <bearded@longhaired.org>
Date: Fri, 25 Feb 2022 22:20:44 +0100
Subject: warnings: Ignore some error returns

that we can do nothing useful with.
---
 src/display.c |  4 +++-
 src/process.c |  4 +++-
 src/screen.c  | 24 +++++++++++++++++-------
 src/socket.c  | 13 +++++++++----
 src/window.c  | 12 ++++++++----
 5 files changed, 40 insertions(+), 17 deletions(-)

diff --git a/src/display.c b/src/display.c
index 0c4ab36..d0fe93e 100644
--- a/src/display.c
+++ b/src/display.c
@@ -3180,9 +3180,11 @@ int eat;
   FD_SET(D_userfd, &r);
   if (select(FD_SETSIZE, &r, (fd_set *)0, (fd_set *)0, &t) > 0)
     {
+      int ignore;
       debug("display activity stopped sleep\n");
       if (eat)
-        read(D_userfd, &buf, 1);
+        ignore = read(D_userfd, &buf, 1);
+      (void)ignore;
     }
   debug2("DisplaySleep(%d) ending, eat was %d\n", n, eat);
 }
diff --git a/src/process.c b/src/process.c
index 004b22a..b1777d3 100644
--- a/src/process.c
+++ b/src/process.c
@@ -6273,8 +6273,10 @@ char *data;	/* dummy */
     }
   if (ktab[(int)(unsigned char)*buf].nr != RC_POW_DETACH)
     {
+      int ignore;
       if (display)
-        write(D_userfd, "\007", 1);
+        ignore = write(D_userfd, "\007", 1);
+      (void)ignore;
       Msg(0, "Detach aborted.");
     }
   else
diff --git a/src/screen.c b/src/screen.c
index 8bce303..1b8ce2f 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -1658,6 +1658,7 @@ static sigret_t CoreDump SIGDEFARG
   char buf[80];
   char *dump_msg = " (core dumped)";
   int running_w_s_bit = getuid() != geteuid();
+  int ignore;
 
 #if defined(SHADOWPW) && !defined(DEBUG) && !defined(DUMPSHADOW)
   if (running_w_s_bit)
@@ -1682,7 +1683,8 @@ static sigret_t CoreDump SIGDEFARG
     continue;
       fcntl(disp->d_userfd, F_SETFL, 0);
       SetTTY(disp->d_userfd, &D_OldMode);
-      write(disp->d_userfd, buf, strlen(buf));
+      ignore = write(disp->d_userfd, buf, strlen(buf));
+      (void)ignore;
       Kill(disp->d_userpid, SIG_BYE);
   }
 
@@ -2102,6 +2104,7 @@ void MakeNewEnv()
 DEFINE_VARARGS_FN(Msg)
 {
   char buf[MAXPATHLEN*2];
+  int ignore;
   PROCESS_MESSAGE(buf);
 
   debug2("Msg('%s') (%#x);\n", buf, (unsigned int)display);
@@ -2126,7 +2129,8 @@ DEFINE_VARARGS_FN(Msg)
     printf("%s\r\n", buf);
 
   if (queryflag >= 0)
-    write(queryflag, buf, strlen(buf));
+    ignore = write(queryflag, buf, strlen(buf));
+  (void)ignore;
 }
 
 /*
@@ -2135,6 +2139,7 @@ DEFINE_VARARGS_FN(Msg)
 DEFINE_VARARGS_FN(Panic)
 {
   char buf[MAXPATHLEN*2];
+  int ignore;
   PROCESS_MESSAGE(buf);
 
   debug3("Panic('%s'); display=%x displays=%x\n", buf, display, displays);
@@ -2164,8 +2169,9 @@ DEFINE_VARARGS_FN(Panic)
 #endif
       SetTTY(D_userfd, &D_OldMode);
       fcntl(D_userfd, F_SETFL, 0);
-      write(D_userfd, buf, strlen(buf));
-      write(D_userfd, "\n", 1);
+      ignore = write(D_userfd, buf, strlen(buf));
+      ignore = write(D_userfd, "\n", 1);
+      (void)ignore;
       freetty();
       if (D_userpid)
         Kill(D_userpid, SIG_BYE);
@@ -2190,12 +2196,14 @@ DEFINE_VARARGS_FN(Panic)
 DEFINE_VARARGS_FN(QueryMsg)
 {
   char buf[MAXPATHLEN*2];
+  int ignore;
 
   if (queryflag < 0)
     return;
 
   PROCESS_MESSAGE(buf);
-  write(queryflag, buf, strlen(buf));
+  ignore = write(queryflag, buf, strlen(buf));
+  (void)ignore;
 }
 
 DEFINE_VARARGS_FN(Dummy)
@@ -3144,6 +3152,7 @@ static void serv_read_fn(struct event *ev, char *data)
 static void serv_select_fn(struct event *ev, char *data)
 {
   struct win *p;
+  int ignore;
   debug("serv_select_fn called\n");
   /* XXX: messages?? */
   if (GotSigChld)
@@ -3162,13 +3171,14 @@ static void serv_select_fn(struct event *ev, char *data)
 
 
 #ifdef PSEUDOS
-      write(W_UWP(fore) ? fore->w_pwin->p_ptyfd : fore->w_ptyfd, &ibuf, 1);
+      ignore = write(W_UWP(fore) ? fore->w_pwin->p_ptyfd : fore->w_ptyfd, &ibuf, 1);
       debug1("Backend wrote interrupt to %d", fore->w_number);
       debug1("%s\n", W_UWP(fore) ? " (pseudowin)" : "");
 #else
-      write(fore->w_ptyfd, &ibuf, 1);
+      ignore = write(fore->w_ptyfd, &ibuf, 1);
       debug1("Backend wrote interrupt to %d\n", fore->w_number);
 #endif
+      (void)ignore;
     }
     InterruptPlease = 0;
   }
diff --git a/src/socket.c b/src/socket.c
index bb68b35..bc6d7bb 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -865,6 +865,7 @@ struct win *wi;
   int i;
   struct mode Mode;
   struct display *olddisplays = displays;
+  int ignore;
 
   switch (m->type)
     {
@@ -958,7 +959,8 @@ struct win *wi;
     {
       if (display || wi)
 	{
-	  write(i, "Attaching from inside of screen?\n", 33);
+	  ignore = write(i, "Attaching from inside of screen?\n", 33);
+	  (void)ignore;
 	  close(i);
 	  Kill(pid, SIG_BYE);
 	  Msg(0, "Attach msg ignored: coming from inside.");
@@ -969,7 +971,8 @@ struct win *wi;
       if (strcmp(user, LoginName))
 	if (*FindUserPtr(user) == 0)
 	  {
-	      write(i, "Access to session denied.\n", 26);
+	      ignore = write(i, "Access to session denied.\n", 26);
+	      (void)ignore;
 	      close(i);
 	      Kill(pid, SIG_BYE);
 	      Msg(0, "Attach: access denied for user %s.", user);
@@ -981,7 +984,8 @@ struct win *wi;
 #ifndef MULTI
       if (displays)
 	{
-	  write(i, "Screen session in use.\n", 23);
+	  ignore = write(i, "Screen session in use.\n", 23);
+	  (void)ignore;
 	  close(i);
 	  Kill(pid, SIG_BYE);
 	  return -1;
@@ -993,7 +997,8 @@ struct win *wi;
   GetTTY(i, &Mode);
   if (MakeDisplay(user, m->m_tty, attach ? m->m.attach.envterm : "", i, pid, &Mode) == 0)
     {
-      write(i, "Could not make display.\n", 24);
+      ignore = write(i, "Could not make display.\n", 24);
+      (void)ignore;
       close(i);
       Msg(0, "Attach: could not make display for user %s", user);
       Kill(pid, SIG_BYE);
diff --git a/src/window.c b/src/window.c
index db03f01..dbd6e60 100644
--- a/src/window.c
+++ b/src/window.c
@@ -979,8 +979,10 @@ struct win *wp;
   if (wp->w_type == W_TYPE_PTY)
     {
       /* pty 4 SALE */
-      (void)chmod(wp->w_tty, 0666);
-      (void)chown(wp->w_tty, 0, 0);
+      int ignore;
+      ignore = chmod(wp->w_tty, 0666);
+      ignore = chown(wp->w_tty, 0, 0);
+      (void)ignore;
     }
   close(wp->w_ptyfd);
   wp->w_ptyfd = -1;
@@ -1687,6 +1689,7 @@ FreePseudowin(w)
 struct win *w;
 {
   struct pseudowin *pwin = w->w_pwin;
+  int ignore;
 
   ASSERT(pwin);
   if (fcntl(w->w_ptyfd, F_SETFL, FNBLOCK))
@@ -1700,8 +1703,9 @@ struct win *w;
     }
 #endif
   /* should be able to use CloseDevice() here */
-  (void)chmod(pwin->p_tty, 0666);
-  (void)chown(pwin->p_tty, 0, 0);
+  ignore = chmod(pwin->p_tty, 0666);
+  ignore = chown(pwin->p_tty, 0, 0);
+  (void)ignore;
   if (pwin->p_ptyfd >= 0)
     close(pwin->p_ptyfd);
   evdeq(&pwin->p_readev);
-- 
2.30.2

