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