Changeset 0f0e130 in rtems


Ignore:
Timestamp:
Oct 10, 2018, 7:11:47 AM (6 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
0dc303f
Parents:
bf4c7ff6
git-author:
Sebastian Huber <sebastian.huber@…> (10/10/18 07:11:47)
git-committer:
Sebastian Huber <sebastian.huber@…> (10/10/18 12:06:28)
Message:

telnetd: Allocate the server context

Update #3543.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/telnetd/telnetd.c

    rbf4c7ff6 r0f0e130  
    8181  struct sockaddr     sa;
    8282} uni_sa;
    83 
    84 /***********************************************************/
    85 static telnetd_context telnetd_instance;
    8683
    8784static telnetd_session *grab_a_Connection(telnetd_context *ctx)
     
    246243    close(ctx->server_socket);
    247244  }
     245
     246  free(ctx);
    248247}
    249248
     
    289288rtems_status_code rtems_telnetd_start(const rtems_telnetd_config_table* config)
    290289{
    291   telnetd_context *ctx = &telnetd_instance;
     290  telnetd_context *ctx;
    292291  rtems_id task_id;
    293292  rtems_status_code sc;
     
    298297  }
    299298
    300   if (ctx->config.command != NULL) {
    301     syslog(LOG_DAEMON | LOG_ERR, "telnetd: already started");
    302     return RTEMS_RESOURCE_IN_USE;
     299  ctx = calloc(1, sizeof(*ctx));
     300  if (ctx == NULL) {
     301    syslog(LOG_DAEMON | LOG_ERR, "telnetd: cannot allocate server context");
     302    return RTEMS_UNSATISFIED;
    303303  }
    304304
    305305  ctx->config = *config;
     306  ctx->server_socket = -1;
    306307
    307308  /* Check priority */
Note: See TracChangeset for help on using the changeset viewer.