Dan Johansson <dan.johans...@dmj.nu> [16-06-26 18:12]: > The following code snippet compiles find but when run it just hangs forever: > > $ cat x.c > #include <stdio.h> > #include <unistd.h> > #include <crypt.h> > > int main() { > printf("Running test\n"); > char *encrypted = crypt("blablabla","ab"); > if(!encrypted || strcmp(encrypted,"ab.h7fshjf89f")) { > printf("Fail\n"); > } else { > printf("OK\n"); > } > } > > $ gcc -o xout x.c -lcrypt > > $ ./xout > Running test > > <here the program just hangs and needs to be killed with ^C> > > The same code runs fine on my desktop. > Any suggestions what could be my problem? > > -- > Dan Johansson, <http://www.dmj.nu> > *************************************************** > This message is printed on 100% recycled electrons! > *************************************************** >
Hi Dan, this is just a shot in the dark and most likely I will miss the target...but... Off what kind of memory you are running this code? Das "cryot()" returns a pointer to newly acquired memory? May be this memory is not RAM but flash/EEPROM? If crypt() expects already allocated memory at the pointers adress this may work on a PC because its short and the stack is relatively large and you hit nothing ... so it runs accidentally (so to say) and fails on a Raspi... Only some random thoughts... Good luck! Best regards, Meino