1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-01 20:30:28 +02:00

Verify the value of `SHUT_RD' and related constants.

* libguile/socket.c: Add `verify' clauses for the values of `SHUT_RD',
  `SHUT_WR', and `SHUT_RDWR'.
This commit is contained in:
Ludovic Courtès 2012-12-10 23:14:10 +01:00
parent 4578dc9479
commit cc94810708

View file

@ -1,5 +1,5 @@
/* Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, /* Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005,
* 2006, 2007, 2009, 2011 Free Software Foundation, Inc. * 2006, 2007, 2009, 2011, 2012 Free Software Foundation, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License * modify it under the terms of the GNU Lesser General Public License
@ -26,6 +26,7 @@
#include <errno.h> #include <errno.h>
#include <gmp.h> #include <gmp.h>
#include <verify.h>
#include "libguile/_scm.h" #include "libguile/_scm.h"
#include "libguile/arrays.h" #include "libguile/arrays.h"
@ -742,6 +743,11 @@ SCM_DEFINE (scm_setsockopt, "setsockopt", 4, 0, 0,
} }
#undef FUNC_NAME #undef FUNC_NAME
/* Our documentation hard-codes this mapping, so make sure it holds. */
verify (SHUT_RD == 0);
verify (SHUT_WR == 1);
verify (SHUT_RDWR == 2);
SCM_DEFINE (scm_shutdown, "shutdown", 2, 0, 0, SCM_DEFINE (scm_shutdown, "shutdown", 2, 0, 0,
(SCM sock, SCM how), (SCM sock, SCM how),
"Sockets can be closed simply by using @code{close-port}. The\n" "Sockets can be closed simply by using @code{close-port}. The\n"