]> Savannah Git Hosting - gnulib.git/commitdiff
ptsname_r: Fix a compiler warning on Solaris.
authorBruno Haible <bruno@clisp.org>
Tue, 29 Dec 2020 02:05:25 +0000 (03:05 +0100)
committerBruno Haible <bruno@clisp.org>
Tue, 29 Dec 2020 02:05:25 +0000 (03:05 +0100)
* lib/ptsname_r.c (__ptsname_r): Reduce the scope of variable 'err'.

ChangeLog
lib/ptsname_r.c

index 29184d2b6b8867a2e8d3ed70f43e2e7e76b95460..53be43408bf765b1da6f082dcb8830cf48b510dd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2020-12-28  Bruno Haible  <bruno@clisp.org>
+
+       ptsname_r: Fix a compiler warning on Solaris.
+       * lib/ptsname_r.c (__ptsname_r): Reduce the scope of variable 'err'.
+
 2020-12-28  Bruno Haible  <bruno@clisp.org>
 
        gnulib-tool: Fix logic whether to add a dummy.c.
index 99d1701dc7994e5e1c57595d577bc840d3bd392d..0008b95304d1d4d1ba0d795ac6af35d5bc8ab3ee 100644 (file)
@@ -86,7 +86,6 @@ __ptsname_r (int fd, char *buf, size_t buflen)
     return errno;
 #else
   int save_errno = errno;
-  int err;
   struct stat st;
 
   if (buf == NULL)
@@ -187,7 +186,7 @@ __ptsname_r (int fd, char *buf, size_t buflen)
       return ERANGE;
     }
 
-  err = __ttyname_r (fd, buf, buflen);
+  int err = __ttyname_r (fd, buf, buflen);
   if (err != 0)
     {
       __set_errno (err);