Changeset 17b2aac in mainline


Ignore:
Timestamp:
2008-08-12T11:09:16Z (16 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4bf40f6
Parents:
34a74ab
Message:

Fix handling of relative paths in task_spawn().

Location:
uspace/lib/libc
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/libc/generic/task.c

    r34a74ab r17b2aac  
    4242#include <async.h>
    4343#include <errno.h>
     44#include <vfs/vfs.h>
    4445
    4546task_id_t task_get_id(void)
     
    131132        ipcarg_t retval;
    132133
     134        char *pa;
     135        size_t pa_len;
     136
     137        pa = absolutize(path, &pa_len);
     138        if (!pa)
     139                return 0;
     140
    133141        /* Spawn a program loader */   
    134142        phone_id = task_spawn_loader();
    135         if (phone_id < 0) return 0;
     143        if (phone_id < 0)
     144                return 0;
    136145
    137146        /*
     
    140149         */
    141150        rc = async_req_0_0(phone_id, LOADER_HELLO);
    142         if (rc != EOK) return 0;
     151        if (rc != EOK)
     152                return 0;
    143153
    144154        /* Send program pathname */
    145155        req = async_send_0(phone_id, LOADER_SET_PATHNAME, &answer);
    146         rc = ipc_data_write_start(phone_id, (void *)path, strlen(path));
     156        rc = ipc_data_write_start(phone_id, (void *)pa, pa_len);
    147157        if (rc != EOK) {
    148158                async_wait_for(req, NULL);
     
    151161
    152162        async_wait_for(req, &retval);
    153         if (retval != EOK) goto error;
     163        if (retval != EOK)
     164                goto error;
    154165
    155166        /* Send arguments */
    156167        rc = loader_set_args(phone_id, argv);
    157         if (rc != EOK) goto error;
     168        if (rc != EOK)
     169                goto error;
    158170
    159171        /* Request loader to start the program */       
    160172        rc = async_req_0_0(phone_id, LOADER_RUN);
    161         if (rc != EOK) goto error;
     173        if (rc != EOK)
     174                goto error;
    162175
    163176        /* Success */
  • uspace/lib/libc/generic/vfs/vfs.c

    r34a74ab r17b2aac  
    6060size_t cwd_len = 0;
    6161
    62 static char *absolutize(const char *path, size_t *retlen)
     62char *absolutize(const char *path, size_t *retlen)
    6363{
    6464        char *ncwd_path;
  • uspace/lib/libc/include/vfs/vfs.h

    r34a74ab r17b2aac  
    3636#define LIBC_VFS_H_
    3737
     38#include <sys/types.h>
     39
     40extern char *absolutize(const char *, size_t *);
     41
    3842extern int mount(const char *, const char *, const char *);
    3943
Note: See TracChangeset for help on using the changeset viewer.