Changeset 1353 for TI05-delivery/trunk


Ignore:
Timestamp:
03/08/06 10:35:04 (13 years ago)
Author:
spascoe
Message:

Added a convenient debugging funtion ndg_debug_sleep(). Also
made the argument passing to bbftpd_main slightly more conservative.

Location:
TI05-delivery/trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • TI05-delivery/trunk/src/bbftp-server-3.2.0/bbftpd/bbftpd_log.c

    r1334 r1353  
    7171    fprintf(logfh, "\n"); 
    7272  } 
    73    
     73  fflush(logfh); 
     74 
    7475  va_end(ap); 
    7576   
  • TI05-delivery/trunk/src/python_ext/bbftpd.c

    r1332 r1353  
    6464   *      failure rather than error. 
    6565   */ 
    66   if ((authzHandler = PyObject_CallMethod(authHandler, "authenticate", "")) == NULL) { 
     66  if ((authzHandler = PyObject_CallMethod(authHandler, "authenticate", NULL)) == NULL) { 
    6767    ndg_pyerr_to_logmessage(logmessage, "ndg_auth"); 
    6868    return -1; 
     
    243243  PyObject *ret; 
    244244 
     245  ndg_debug_sleep(15); 
     246 
    245247  if (!PyArg_ParseTuple(args, "")) { 
    246248    return NULL; 
     
    260262  ret = Py_BuildValue("s#", buffer, len); 
    261263  free(buffer); 
     264 
    262265  return ret; 
    263266} 
     
    270273static PyObject *pybbftpd_run(PyObject *self, PyObject *args) { 
    271274  int argc, i; 
    272   char **argv, **arg_p; 
     275  char **argv, **arg_p, *p; 
    273276  int pid; 
    274277  char preargs[2][20] = { "bbftpd_embedded", "-b" }; 
     
    303306      return NULL; 
    304307    } 
    305     if ((*arg_p = PyString_AsString(item)) == NULL) { 
     308    if ((p = PyString_AsString(item)) == NULL) { 
    306309      free(argv); 
    307310      Py_DECREF(item); 
     
    310313      return NULL; 
    311314    } 
     315    if ((*arg_p = (char *)malloc(strlen(p))) == NULL) { 
     316      Py_DECREF(item); 
     317      Py_DECREF(authHandler); 
     318      Py_DECREF(daemon_args); 
     319      PyErr_SetString(PyExc_MemoryError, "malloc failed"); 
     320      return NULL; 
     321    } 
     322    strcpy(*arg_p, p); 
     323 
    312324    arg_p++; 
    313325    Py_DECREF(item); 
  • TI05-delivery/trunk/src/python_ext/util.c

    r1289 r1353  
    1313#include <string.h> 
    1414#include <Python.h> 
     15#include <unistd.h> 
     16#include <stdio.h> 
    1517 
    1618#include "util.h" 
     19 
     20/** 
     21 * dump pid to a file and sleep.  For use when debugging. 
     22 * @param secs number of seconds to sleep 
     23 */ 
     24void ndg_debug_sleep(int secs) { 
     25  FILE *fh; 
     26  fh = fopen("pybbftpd.pid", "w"); 
     27  fprintf(fh, "%d\n", getpid()); 
     28  fclose(fh); 
     29 
     30  sleep(secs); 
     31} 
     32     
    1733 
    1834/** 
  • TI05-delivery/trunk/src/python_ext/util.h

    r1289 r1353  
    2727 
    2828void ndg_pyerr_to_logmessage(char *logmessage, char *prefix); 
     29void ndg_debug_sleep(int secs); 
    2930 
Note: See TracChangeset for help on using the changeset viewer.