LibC: Fix fread argument order in gethostname

This commit is contained in:
Bananymous 2024-12-03 16:15:16 +02:00
parent 79e2c5d48c
commit bc93d238dd
1 changed files with 1 additions and 1 deletions

View File

@ -142,7 +142,7 @@ int gethostname(char* name, size_t namelen)
FILE* fp = fopen("/etc/hostname", "r"); FILE* fp = fopen("/etc/hostname", "r");
if (fp == NULL) if (fp == NULL)
return -1; return -1;
size_t nread = fread(name, namelen - 1, 1, fp); size_t nread = fread(name, 1, namelen - 1, fp);
while (nread > 0 && name[nread - 1] == '\n') while (nread > 0 && name[nread - 1] == '\n')
nread--; nread--;
name[nread] = '\0'; name[nread] = '\0';