[email protected], le dim. 28 sept. 2025 19:17:18 +0100, a ecrit:
> From: Diego Nieto Cid <[email protected]>
>
> ../../boot/boot.c: In function 'read_boot_script':
> ../../boot/boot.c:468:7: warning: ignoring return value of 'write'
> declared with attribute 'warn_unused_result' [-Wunused-result]
> ../../boot/boot.c:474:7: warning: ignoring return value of 'write'
> declared with attribute 'warn_unused_result' [-Wunused-result]
> ../../boot/boot.c:494:15: warning: ignoring return value of 'write'
> declared with attribute 'warn_unused_result' [-Wunused-result]
> ../../boot/boot.c: In function 'main':
>
> ../../boot/boot.c:641:5: warning: ignoring return value of 'asprintf'
> declared with attribute 'warn_unused_result' [-Wunused-result]
> ../../boot/boot.c:662:7: warning: ignoring return value of 'write'
> declared with attribute 'warn_unused_result' [-Wunused-result]
> ../../boot/boot.c:683:12: warning: ignoring return value of 'asprintf'
> declared with attribute 'warn_unused_result' [-Wunused-result]
> ../../boot/boot.c:686:12: warning: ignoring return value of 'write'
> declared with attribute 'warn_unused_result' [-Wunused-result]
> ../../boot/boot.c:716:13: warning: ignoring return value of 'write'
> declared with attribute 'warn_unused_result' [-Wunused-result]
> ../../boot/boot.c:717:13: warning: ignoring return value of 'write'
> declared with attribute 'warn_unused_result' [-Wunused-result]
> ../../boot/boot.c:718:13: warning: ignoring return value of 'write'
> declared with attribute 'warn_unused_result' [-Wunused-result]
> ../../boot/boot.c:719:13: warning: ignoring return value of 'write'
> declared with attribute 'warn_unused_result' [-Wunused-result]
> ../../boot/boot.c:732:7: warning: ignoring return value of 'write'
> declared with attribute 'warn_unused_result' [-Wunused-result]
> ../../boot/boot.c:733:7: warning: ignoring return value of 'read'
> declared with attribute 'warn_unused_result' [-Wunused-result]
> ../../boot/boot.c:747:9: warning: ignoring return value of 'write'
> declared with attribute 'warn_unused_result' [-Wunused-result]
> ../../boot/boot.c:748:9: warning: ignoring return value of 'write'
> declared with attribute 'warn_unused_result' [-Wunused-result]
>
> ../../boot/boot.c: In function 'do_mach_notify_no_senders':
> ../../boot/boot.c:1360:11: warning: ignoring return value of 'write'
> declared with attribute 'warn_unused_result' [-Wunused-result]
> ---
> boot/boot.c | 60 ++++++++++++++++++++++++++++++++++++-----------------
> 1 file changed, 41 insertions(+), 19 deletions(-)
>
> diff --git a/boot/boot.c b/boot/boot.c
> index b6301379..0e19b9dd 100644
> --- a/boot/boot.c
> +++ b/boot/boot.c
> @@ -457,17 +457,20 @@ read_boot_script (char **buffer, size_t *length)
> static const char memmsg[] = "Not enough memory\n";
> int i, fd;
> size_t amt, len;
> + ssize_t err;
>
> fd = open (bootscript, O_RDONLY, 0);
> if (fd < 0)
> {
> - write (2, filemsg, sizeof (filemsg));
> + err = write (2, filemsg, sizeof (filemsg));
> + assert_backtrace (err != -1);
Similarly, we want to check for the exact size.
> host_exit (1);
> }
> p = buf = malloc (500);
> if (!buf)
> {
> - write (2, memmsg, sizeof (memmsg));
> + err = write (2, memmsg, sizeof (memmsg));
> + assert_backtrace (err != -1);
> host_exit (1);
> }
> len = 500;
> @@ -487,7 +490,8 @@ read_boot_script (char **buffer, size_t *length)
> newbuf = realloc (buf, newlen);
> if (!newbuf)
> {
> - write (2, memmsg, sizeof (memmsg));
> + err = write (2, memmsg, sizeof (memmsg));
> + assert_backtrace (err != -1);
> host_exit (1);
> }
> p = newbuf + len;
> @@ -637,8 +641,11 @@ main (int argc, char **argv, char **envp)
> }
>
> if (kernel_command_line == 0)
> - asprintf (&kernel_command_line, "%s %s root=%s",
> - argv[0], bootstrap_args, bootdevice);
> + {
> + int err2 = asprintf (&kernel_command_line, "%s %s root=%s",
> + argv[0], bootstrap_args, bootdevice);
> + assert_backtrace (err2 != -1);
> + }
>
> /* Initialize boot script variables. */
> if (boot_script_set_variable ("host-port", VAL_PORT,
> @@ -658,7 +665,8 @@ main (int argc, char **argv, char **envp)
> {
> static const char msg[] = "error setting variable";
>
> - write (2, msg, strlen (msg));
> + ssize_t err2 = write (2, msg, strlen (msg));
> + assert_backtrace (err2 != -1);
> host_exit (1);
> }
>
> @@ -679,10 +687,11 @@ main (int argc, char **argv, char **envp)
> if (err)
> {
> char *msg;
> - asprintf (&msg, "cannot set boot-script variable %s: %s\n",
> - word, boot_script_error_string (err));
> - assert_backtrace (msg);
> - write (2, msg, strlen (msg));
> + ssize_t err2 = asprintf (&msg, "cannot set boot-script variable
> %s: %s\n",
> + word, boot_script_error_string (err));
> + assert_backtrace (err2 != -1);
> + err2 = write (2, msg, strlen (msg));
> + assert_backtrace (err2 != -1);
> free (msg);
> host_exit (1);
> }
> @@ -707,15 +716,20 @@ main (int argc, char **argv, char **envp)
> err = boot_script_parse_line (0, line);
> if (err)
> {
> + ssize_t err2;
> char *str;
> int i;
>
> str = boot_script_error_string (err);
> i = strlen (str);
> - write (2, str, i);
> - write (2, " in `", 5);
> - write (2, line, strlen (line));
> - write (2, "'\n", 2);
> + err2 = write (2, str, i);
> + assert_backtrace (err2 != -1);
> + err2 = write (2, " in `", 5);
> + assert_backtrace (err2 != -1);
> + err2 = write (2, line, strlen (line));
> + assert_backtrace (err2 != -1);
> + err2 = write (2, "'\n", 2);
> + assert_backtrace (err2 != -1);
> host_exit (1);
> }
> if (p == buf + amt)
> @@ -728,8 +742,11 @@ main (int argc, char **argv, char **envp)
> {
> static const char msg[] = "Pausing. . .";
> char c;
> - write (2, msg, sizeof (msg) - 1);
> - read (0, &c, 1);
> + ssize_t err2;
> + err2 = write (2, msg, sizeof (msg) - 1);
> + assert_backtrace (err2 != -1);
> + err2 = read (0, &c, 1);
> + assert_backtrace (err2 != -1);
> }
>
> init_termstate ();
> @@ -740,11 +757,14 @@ main (int argc, char **argv, char **envp)
> err = boot_script_exec ();
> if (err)
> {
> + ssize_t err2;
> char *str = boot_script_error_string (err);
> int i = strlen (str);
>
> - write (2, str, i);
> - write (2, "\n", 1);
> + err2 = write (2, str, i);
> + assert_backtrace (err2 != -1);
> + err2 = write (2, "\n", 1);
> + assert_backtrace (err2 != -1);
> host_exit (1);
> }
> free (buf);
> @@ -1340,6 +1360,7 @@ kern_return_t
> do_mach_notify_no_senders (mach_port_t notify,
> mach_port_mscount_t mscount)
> {
> + ssize_t err;
> static int no_console;
> mach_port_t foo;
> if (notify == pseudo_master_device_port)
> @@ -1356,7 +1377,8 @@ do_mach_notify_no_senders (mach_port_t notify,
> {
> bye:
> restore_termstate ();
> - write (2, "bye\n", 4);
> + err = write (2, "bye\n", 4);
> + assert_backtrace (err != -1);
> host_exit (0);
> }
> else
> --
> 2.51.0
>
>
--
Samuel
FYLG> Tiens, vlĂ une URL qui va bien :
FYLG> ftp://127.0.0.1/WaReZ/NiouZeS/WinDoZe/NeWSMoNGeR/SuPeR
c'est gentil sauf que l'adresse ne fonctionne pas sa me fais une erreur
-+- Furtif in Guide du Neuneu Usenet : <MODE CERVEAU OFF> -+-