1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-25 20:50:31 +02:00

Avoid throwing exceptions during early boot if stdin is closed

* libguile/fports.c (scm_i_fdes_is_valid): New internal helper.
  (scm_i_fdes_to_port): Use new helper.
* libguile/fports.h: Declare new helper.
* libguile/init.c (scm_standard_stream_to_port): Refactor to use
  scm_i_fdes_is_valid.
This commit is contained in:
Andy Wingo 2019-12-13 13:52:58 +01:00
parent cf693d862d
commit dbc93d6195
3 changed files with 37 additions and 55 deletions

View file

@ -1,7 +1,7 @@
#ifndef SCM_FPORTS_H
#define SCM_FPORTS_H
/* Copyright 1995-2001,2006,2008-2009,2011-2012,2017-2018
/* Copyright 1995-2001,2006,2008-2009,2011-2012,2017-2019
Free Software Foundation, Inc.
This file is part of Guile.
@ -86,8 +86,10 @@ enum scm_fport_option
that case. */
SCM_FPORT_OPTION_NOT_SEEKABLE = 1U<<1
};
SCM_INTERNAL int scm_i_fdes_is_valid (int fdes, long mode_bits);
SCM_INTERNAL SCM scm_i_fdes_to_port (int fdes, long mode_bits, SCM name,
unsigned options);
#endif /* BUILDING_LIBGUILE */
#endif /* SCM_FPORTS_H */