1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:34:59 +00:00

hostname: Handle 'sethostname' errors

This commit is contained in:
Maciej Zygmanowski 2021-06-04 17:10:24 +02:00 committed by Andreas Kling
parent d840608a51
commit bee1e06055

View file

@ -31,7 +31,11 @@ int main(int argc, char** argv)
warnln("Hostname must be less than {} characters", HOST_NAME_MAX);
return 1;
}
sethostname(hostname, strlen(hostname));
int rc = sethostname(hostname, strlen(hostname));
if (rc < 0) {
perror("sethostname");
return 1;
}
}
return 0;
}