Anonymous
No
Mihail
yes
Dexter
okk guys now plz dont make this an ot group
klimi
#ot
Anonymous
Cnt see the chat anymore
Anonymous
It say nt accesble
Dexter
If environment is the problem here
Should i change my IDE
Mr. COwO2 Preis
you should change your os
BinaryByter
klimi
Mr. COwO2 Preis
hi kurimi
klimi
how are you?
Anonymous
Prometheus
No? That's what I was always told.
Anonymous
Prometheus
Could be right.
Mihail
oh we're in main group
Mihail
fuck
Mihail
tought I was in OT
klimi
What
Mihail
because went a bit off-topic
Dexter
Mihail
Mihail
or both
klimi
Or I'm just tired
Bader
Mihail
Likai
hey fam
Likai
I'm trying to fix a segfault
Likai
can someone halp
Likai
https://ideone.com/zOSO0Q
Likai
i am trying to implement ls
Likai
so i made a much of structs that represent a line i want to print out
Likai
and I make a bunch of them and want to store them in a list
Likai
so like a list of structs
Likai
i malloc it
Likai
it dies
Likai
hmm
Likai
it seems to be in prepare_list(output_array, curdir, numfiles);
Likai
something in that is segfaulting
Anonymous
Likai
dirptr = opendir(dir);
while(entry = readdir(dirptr) != NULL) {
printf("%s\n", dir);
printf("%s\n", entry->d_name);
Likai
it's something to do with this bit
Likai
I'll send one of yall some fucking DASH for helping me with this
Likai
i gotta whip this shit together real quick
Likai
mightve figured it out
Likai
while((entry = readdir(dirptr)) != NULL) {
Likai
adding another parantheses fixed
Likai
i fucking guess
Likai
jfc
Likai
fuck c
Likai
nvm it's broken again
Likai
clueless
Likai
https://ideone.com/zOSO0Q
Anonymous
You should probably start using -Werror
Anonymous
entry is a pointer that never gets set so I don't know it could even be used to dereference a structure
Anonymous
On line 173 it looks like you're dereferencing a NULL pointer
Likai
because entry has nothing in it
Likai
okay
Likai
however
Likai
while((entry = readdir(dirptr)) != NULL) {
printf("\nDIR:%s\n", dir);
printf("\nFILE:%s\n", entry->d_name);
char* path = malloc(sizeof(dir) + 1 + sizeof(entry->d_name) + 1);
Likai
i'll just repost
Likai
same problem even with entry exists
Likai
https://ideone.com/NyeAot
Likai
./lsx 12
-rw-------
1540005524
8749396x
numfiles:9
SIZE1:2120
SIZEALL:19080
x1x2here0
DIR:/local/files/ckell035/Documents
FILE:.
Segmentation fault (core dumped)
Likai
something weird is happening with the file thing
Likai
mission failed
Likai
we'll get em next time
olli
we'll get em next time
#43 why pointer to char[254] ?
#174 sizeof(dir) is the size of the pointer, probably not want you want
valgrind might come in handy for such situations, easy to use and it should tell you the issue :)
Likai
thanks for the reply :)
Likai
uh
Likai
what i am curious about
Likai
why is printf(dir) printing the dir correctly