Gentoo Archives: gentoo-user

From: Dan Johansson <dan@×××.nu>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] [OT] program compiled with libcrypt on Raspberry PI (running Gentoo) hangs when run
Date: Sun, 26 Jun 2016 19:25:28
Message-Id: 57702C1B.8050609@dmj.nu
In Reply to: Re: [gentoo-user] [OT] program compiled with libcrypt on Raspberry PI (running Gentoo) hangs when run by Meino.Cramer@gmx.de
1 On 26.06.2016 18:19, Meino.Cramer@×××.de wrote:
2 > Dan Johansson <Dan.Johansson@×××.nu> [16-06-26 18:12]:
3 >> The following code snippet compiles find but when run it just hangs forever:
4 >>
5 >> $ cat x.c
6 >> #include <stdio.h>
7 >> #include <unistd.h>
8 >> #include <crypt.h>
9 >>
10 >> int main() {
11 >> printf("Running test\n");
12 >> char *encrypted = crypt("blablabla","ab");
13 >> if(!encrypted || strcmp(encrypted,"ab.h7fshjf89f")) {
14 >> printf("Fail\n");
15 >> } else {
16 >> printf("OK\n");
17 >> }
18 >> }
19 >>
20 >> $ gcc -o xout x.c -lcrypt
21 >>
22 >> $ ./xout
23 >> Running test
24 >>
25 >> <here the program just hangs and needs to be killed with ^C>
26 >>
27 >> The same code runs fine on my desktop.
28 >> Any suggestions what could be my problem?
29 >>
30 >> --
31 > Hi Dan,
32 >
33 > this is just a shot in the dark and most likely I will miss the
34 > target...but...
35 >
36 > Off what kind of memory you are running this code?
37 > Das "cryot()" returns a pointer to newly acquired memory?
38 > May be this memory is not RAM but flash/EEPROM?
39 > If crypt() expects already allocated memory at the
40 > pointers adress this may work on a PC because its
41 > short and the stack is relatively large and you hit
42 > nothing ... so it runs accidentally (so to say) and
43 > fails on a Raspi...
44 >
45 > Only some random thoughts...
46
47 It's running in "normal" RAM. And I think if it was something like that
48 other software would also have problem, which it has not.
49
50
51 --
52 Dan Johansson
53 ***************************************************
54 This message is printed on 100% recycled electrons!
55 ***************************************************

Replies