/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to plugins.d/mandos-client.c

  • Committer: Teddy Hogeborn
  • Date: 2016-07-03 02:56:00 UTC
  • Revision ID: teddy@recompile.se-20160703025600-bn12vpzejr6zxx5v
mandos-client: Bug fix: flush stdout to detect write errors.

* plugins.d/mandos-client.c (start_mandos_communication): Do
                            fflush(stdout) to detect any write errors.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1423
1423
                                               &decrypted_buffer, mc);
1424
1424
    if(decrypted_buffer_size >= 0){
1425
1425
      
 
1426
      clearerr(stdout);
1426
1427
      written = 0;
1427
1428
      while(written < (size_t) decrypted_buffer_size){
1428
1429
        if(quit_now){
1444
1445
        }
1445
1446
        written += (size_t)ret;
1446
1447
      }
 
1448
      ret = fflush(stdout);
 
1449
      if(ret != 0){
 
1450
        int e = errno;
 
1451
        if(debug){
 
1452
          fprintf_plus(stderr, "Error writing encrypted data: %s\n",
 
1453
                       strerror(errno));
 
1454
        }
 
1455
        errno = e;
 
1456
        goto mandos_end;
 
1457
      }
1447
1458
      retval = 0;
1448
1459
    }
1449
1460
  }