avoid calling write upon flush when called by DeleteProcess default tip
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Thu, 05 May 2011 15:16:49 +0200
changeset 7138b25a74e8e7
parent 70 f88649919a71
avoid calling write upon flush when called by DeleteProcess
model/dce-stdio.cc
     1.1 --- a/model/dce-stdio.cc	Thu May 05 15:15:42 2011 +0200
     1.2 +++ b/model/dce-stdio.cc	Thu May 05 15:16:49 2011 +0200
     1.3 @@ -83,6 +83,11 @@
     1.4  {
     1.5    return 0;
     1.6  }
     1.7 +int my_write_unconditional (_IO_FILE *file)
     1.8 +{
     1.9 +  errno = EBADF;
    1.10 +  return -1;
    1.11 +}
    1.12  int my_stat (_IO_FILE *file, void *buf)
    1.13  {
    1.14    int result = dce_fstat64 (file->_fileno, (struct stat64 *)buf);
    1.15 @@ -299,11 +304,14 @@
    1.16  }
    1.17  int dce_fclose_unconditional(FILE *file)
    1.18  {
    1.19 -  NS_LOG_FUNCTION (Current () << UtilsGetNodeId () << file);
    1.20 +  // Note: it is important here not to call the Current function here
    1.21 +  // because we need to be able to run this function even if there is no context.
    1.22 +  // For example, this is why we have no call to NS_LOG_FUNCTION (Current () ...);
    1.23    struct my_IO_FILE_plus *fp = (struct my_IO_FILE_plus *)file;
    1.24    static struct my_IO_jump_t vtable;
    1.25    memcpy (&vtable, fp->vtable, sizeof(struct my_IO_jump_t));
    1.26    vtable.__close = (void*)my_close_unconditional;
    1.27 +  vtable.__write = (void*)my_write_unconditional;
    1.28    fp->vtable = &vtable;
    1.29    fclose (file);
    1.30    return 0;