aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_get_music.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-06 20:43:42 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-06 20:43:42 +0100
commit6a89966eed6110d0e7a7ec53727c4473d18ad441 (patch)
treece56076af530fdbc94bd41702dda27a815561f2d /src/ft_get_music.c
parentit's going well (diff)
download42-cub3d-6a89966eed6110d0e7a7ec53727c4473d18ad441.tar.gz
42-cub3d-6a89966eed6110d0e7a7ec53727c4473d18ad441.tar.bz2
42-cub3d-6a89966eed6110d0e7a7ec53727c4473d18ad441.tar.xz
42-cub3d-6a89966eed6110d0e7a7ec53727c4473d18ad441.tar.zst
42-cub3d-6a89966eed6110d0e7a7ec53727c4473d18ad441.zip
Fuck execve
Diffstat (limited to 'src/ft_get_music.c')
-rw-r--r--src/ft_get_music.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/ft_get_music.c b/src/ft_get_music.c
index cdd7039..2383e0a 100644
--- a/src/ft_get_music.c
+++ b/src/ft_get_music.c
@@ -15,7 +15,7 @@
#include <stdlib.h>
#include <stdint.h>
-static void
+static int8_t
ft_set_music_cmd(t_map *mlist)
{
uint8_t len;
@@ -24,9 +24,13 @@ static void
len += ft_strlen(FT_MUS_CMD) - 2;
ft_memdel((void**)&mlist->music_cmd);
if (!(mlist->music_cmd = (char *)malloc((len + 1) * sizeof(char))))
- return ;
+ return (-1);
ft_sprintf(mlist->music_cmd, FT_MUS_CMD,
mlist->music_path);
+ ft_free_words(mlist->mcmd_words);
+ if (!(mlist->mcmd_words = ft_split(mlist->music_cmd, ' ')))
+ return (-1);
+ return (0);
}
int8_t
@@ -54,6 +58,5 @@ int8_t
return (-1);
}
clist->mlist.ismusic = 1;
- ft_set_music_cmd(&clist->mlist);
- return (0);
+ return ((ft_set_music_cmd(&clist->mlist) == 0) ? (0) : (-1));
}