Changeset 9eab99a in rtems


Ignore:
Timestamp:
Mar 30, 2009, 5:05:23 PM (11 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, master
Children:
52f8e7aa
Parents:
9fb97de
Message:

2009-03-30 Sebastian Huber <sebastian.huber@…>

  • libcsupport/src/symlink.c: Check if path evaluation handler exists.
  • libnetworking/lib/ftpfs.c: Cleanup.
Location:
cpukit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    r9fb97de r9eab99a  
     12009-03-30      Sebastian Huber <sebastian.huber@embedded-brains.de>
     2
     3        * libcsupport/src/symlink.c: Check if path evaluation handler exists.
     4        * libnetworking/lib/ftpfs.c: Cleanup.
     5
    162009-03-27      Sebastian Huber <sebastian.huber@embedded-brains.de>
    27
  • cpukit/libcsupport/src/symlink.c

    r9fb97de r9eab99a  
    3030
    3131  rtems_filesystem_get_start_loc( sympath, &i, &loc );
     32
     33  if ( !loc.ops->evalformake_h ) {
     34    rtems_set_errno_and_return_minus_one( ENOTSUP );
     35  }
     36
    3237  result = (*loc.ops->evalformake_h)( &sympath[i], &loc, &name_start );
    3338  if ( result != 0 )
  • cpukit/libnetworking/lib/ftpfs.c

    r9fb97de r9eab99a  
    293293  /* Send command argument if necessary */
    294294  if (arg != NULL) {
    295           rv = send( socket, arg, strlen( arg), 0);
    296           if (rv < 0) {
    297             return RTEMS_FTPFS_REPLY_ERROR;
    298           }
     295    rv = send( socket, arg, strlen( arg), 0);
     296    if (rv < 0) {
     297      return RTEMS_FTPFS_REPLY_ERROR;
     298    }
    299299    if (verbose) {
    300300      write( STDERR_FILENO, arg, strlen( arg));
     
    439439}
    440440
    441 static void rtems_ftpfs_terminate( rtems_ftpfs_entry *e, rtems_libio_t *iop)
    442 {
     441static void rtems_ftpfs_terminate( rtems_libio_t *iop)
     442{
     443  rtems_ftpfs_entry *e = iop->data1;
     444
    443445  if (e != NULL) {
    444446    /* Close data connection if necessary */
     
    559561  int eno = 0;
    560562  rtems_ftpfs_reply reply = RTEMS_FTPFS_REPLY_ERROR;
    561   struct in_addr address = { .s_addr = 0 };
    562563  struct sockaddr_in sa;
    563564  socklen_t size = 0;
     
    677678)
    678679{
    679   rtems_ftpfs_pasv_entry *e = (rtems_ftpfs_pasv_entry *) arg;
     680  rtems_ftpfs_pasv_entry *e = arg;
    680681  size_t i = 0;
    681682
     
    726727  rtems_ftpfs_reply reply = RTEMS_FTPFS_REPLY_ERROR;
    727728  struct sockaddr_in sa;
    728   socklen_t size = 0;
    729729  uint32_t data_address = 0;
    730730  uint16_t data_port = 0;
     
    787787)
    788788{
    789   int rv = 0;
    790789  int eno = 0;
    791790  bool ok = false;
     
    799798    : "RETR ";
    800799  uint32_t client_address = 0;
    801   char *location = strdup( (const char *) iop->file_info);
    802 
    803   /* Check allocation */
     800  char *location = iop->file_info;
     801
     802  /* Invalidate data handle */
     803  iop->data1 = NULL;
     804
     805  /* Check location, it was allocated during path evaluation */
    804806  if (location == NULL) {
    805807    return ENOMEM;
     
    811813      && (iop->flags & LIBIO_FLAGS_READ) != 0
    812814  ) {
    813     eno = ENOTSUP;
    814     goto cleanup;
     815    return ENOTSUP;
    815816  }
    816817
     
    824825  );
    825826  if (!ok) {
    826     eno = ENOENT;
    827     goto cleanup;
     827    return ENOENT;
    828828  }
    829829  DEBUG_PRINTF(
     
    837837  e = malloc( sizeof( *e));
    838838  if (e == NULL) {
    839     eno = ENOMEM;
    840     goto cleanup;
     839    return ENOMEM;
    841840  }
    842841
     
    845844  e->data_socket = -1;
    846845  e->eof = false;
     846
     847  /* Save connection state */
     848  iop->data1 = e;
    847849
    848850  /* Open control connection */
     
    877879cleanup:
    878880
    879   /* Free location parts buffer */
    880   free( location);
    881 
    882   if (eno == 0) {
    883     /* Save connection state */
    884     iop->data1 = e;
    885   } else {
     881  if (eno != 0) {
    886882    /* Free all resources if an error occured */
    887     rtems_ftpfs_terminate( e, iop);
     883    rtems_ftpfs_terminate( iop);
    888884  }
    889885
     
    897893)
    898894{
    899   rtems_ftpfs_entry *e = (rtems_ftpfs_entry *) iop->data1;
    900   char *in = (char *) buffer;
     895  rtems_ftpfs_entry *e = iop->data1;
     896  char *in = buffer;
    901897  size_t todo = count;
    902898
     
    935931)
    936932{
    937   rtems_ftpfs_entry *e = (rtems_ftpfs_entry *) iop->data1;
    938   const char *out = (const char *) buffer;
     933  rtems_ftpfs_entry *e = iop->data1;
     934  const char *out = buffer;
    939935  size_t todo = count;
    940936
     
    969965static int rtems_ftpfs_close( rtems_libio_t *iop)
    970966{
    971   rtems_ftpfs_entry *e = (rtems_ftpfs_entry *) iop->data1;
    972 
    973   rtems_ftpfs_terminate( e, iop);
     967  rtems_ftpfs_terminate( iop);
    974968
    975969  return 0;
     
    991985   * The caller of this routine has striped off the mount prefix from the path.
    992986   * We need to store this path here or otherwise we would have to do this job
    993    * again.  It is not possible to allocate resources here since there is no
    994    * way to free them later in every case.  The path is used in
    995    * rtems_ftpfs_open() via iop->file_info.
    996    *
    997    * FIXME: Avoid to discard the const qualifier.
     987   * again.  The path is used in rtems_ftpfs_open() via iop->file_info.
    998988   */
    999   pathloc->node_access = (void *) pathname;
     989  pathloc->node_access = strdup( pathname);
    1000990
    1001991  return 0;
    1002992}
    1003993
    1004 static int rtems_ftpfs_eval_for_make(
    1005   const char *pathname,
    1006   rtems_filesystem_location_info_t *pathloc,
    1007   const char **name
    1008 )
    1009 {
    1010   rtems_set_errno_and_return_minus_one( EIO);
     994static int rtems_ftpfs_free_node( rtems_filesystem_location_info_t *pathloc)
     995{
     996  free( pathloc->node_access);
     997
     998  return 0;
    1011999}
    10121000
     
    10651053const rtems_filesystem_operations_table rtems_ftpfs_ops = {
    10661054  .evalpath_h = rtems_ftpfs_eval_path,
    1067   .evalformake_h = rtems_ftpfs_eval_for_make,
     1055  .evalformake_h = NULL,
    10681056  .link_h = NULL,
    10691057  .unlink_h = NULL,
     
    10711059  .mknod_h = NULL,
    10721060  .chown_h = NULL,
    1073   .freenod_h = NULL,
     1061  .freenod_h = rtems_ftpfs_free_node,
    10741062  .mount_h = NULL,
    10751063  .fsmount_me_h = rtems_ftpfs_mount_me,
Note: See TracChangeset for help on using the changeset viewer.