Changeset 7f19876


Ignore:
Timestamp:
Apr 5, 2009, 8:09:13 PM (12 years ago)
Author:
James M. Kretchmar <kretch@mit.edu>
Branches:
owl
Children:
d1948ce
Parents:
a412918
Message:
fix stderr redirector
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    ra412918 r7f19876  
    44        Fix some strcpy's that could be vulnerable
    55        Remove an unused function
     6        Fix stderr redirector, now creating admin messages
    67
    782.2.0
  • owl.c

    rdb654df r7f19876  
    737737
    738738/* Sends stderr (read from rfd) messages to the error console */
    739 void stderr_redirect_handler(int handle, int rfd, int eventmask, void *data)
     739void stderr_redirect_handler(owl_dispatch *d)
    740740{
    741741  int navail, bread;
    742   char *buf;
    743   /*owl_function_debugmsg("stderr_redirect: called with rfd=%d\n", rfd);*/
     742  char buf[4096];
     743  int rfd = d->fd;
    744744  if (rfd<0) return;
    745745  if (-1 == ioctl(rfd, FIONREAD, (void*)&navail)) {
     
    747747  }
    748748  /*owl_function_debugmsg("stderr_redirect: navail = %d\n", navail);*/
    749   if (navail<=0) return;
    750   if (navail>256) { navail = 256; }
    751   buf = owl_malloc(navail+1);
     749  if (navail <= 0) return;
     750  if (navail > sizeof(buf)-1) {
     751    navail = sizeof(buf)-1;
     752  }
    752753  bread = read(rfd, buf, navail);
    753754  if (buf[navail-1] != '\0') {
    754755    buf[navail] = '\0';
    755756  }
    756   owl_function_error("Err: %s", buf);
    757   owl_free(buf);
     757  owl_function_error("[stderr]\n%s", buf);
    758758}
    759759
Note: See TracChangeset for help on using the changeset viewer.