Skip to content

Instantly share code, notes, and snippets.

@saidelike
Created February 17, 2022 15:24
Show Gist options
  • Save saidelike/48eba4d91d7b68e368ce870d3ea9eb1a to your computer and use it in GitHub Desktop.
Save saidelike/48eba4d91d7b68e368ce870d3ea9eb1a to your computer and use it in GitHub Desktop.
int __fastcall write_to_file(void *data_to_write, size_t len_to_write, int fd)
{
// [COLLAPSED LOCAL DECLARATIONS. PRESS KEYPAD CTRL-"+" TO EXPAND]
total_written = 0;
do
{
while ( 1 )
{
len_written = write(fd, data_to_write, len_to_write);
len_written_1 = len_written;
if ( len_written < 0 )
break;
if ( !len_written )
goto b_error;
data_to_write = (char *)data_to_write + len_written;
total_written += len_written;
len_to_write -= len_written;
if ( !len_to_write )
return total_written;
}
}
while ( *_errno_location() == EINTR );
b_error:
printf("%s:%d [%s] rc = %d\n", "../git/hydra/flash/flashfile.c", 0x153, "write_to_file", len_written_1);
return 0xFFFFFFFF;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment