LibC: Fix fread argument order in gethostname
This commit is contained in:
parent
79e2c5d48c
commit
bc93d238dd
|
@ -142,7 +142,7 @@ int gethostname(char* name, size_t namelen)
|
|||
FILE* fp = fopen("/etc/hostname", "r");
|
||||
if (fp == NULL)
|
||||
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')
|
||||
nread--;
|
||||
name[nread] = '\0';
|
||||
|
|
Loading…
Reference in New Issue