Segfault in ret2libc attack, but not hardcoded system call

I have the following protostar challenge #include <stdlib.h> #include <unistd.h> #include <stdio.h> #include <string.h> void getpath() { char buffer[BUFFSIZE]; char