Initialize timeout parameter to -1 in main_server.c

Fixed uninitialized timeout variables in metadata_server_main() and
chunk_server_main() functions by setting default value to -1.

**Changes:**
- metadata_server_main(): Changed `int timeout;` to `int timeout = -1;`
- chunk_server_main(): Changed `int timeout;` to `int timeout = -1;`

This ensures the timeout parameter has a defined default value before
being passed to init functions, which is important for predictable
behavior even though the init functions set the value themselves.

All build targets (tinydfs_server.out, example_client.out,
tinydfs_test.out) compile and run successfully.
This commit is contained in:
Claude
2025-11-02 13:07:06 +00:00
parent dc4fb33be2
commit 0d3edf9155
+2 -2
View File
@@ -18,7 +18,7 @@ int metadata_server_main(int argc, char **argv)
void *contexts[MAX_CONNS+1];
struct pollfd polled[MAX_CONNS+1];
int num_polled;
int timeout;
int timeout = -1;
MetadataServer state;
num_polled = metadata_server_init(
&state, argc, argv, contexts, polled, &timeout);
@@ -38,7 +38,7 @@ int chunk_server_main(int argc, char **argv)
void *contexts[MAX_CONNS+1];
struct pollfd polled[MAX_CONNS+1];
int num_polled;
int timeout;
int timeout = -1;
ChunkServer state;
num_polled = chunk_server_init(
&state, argc, argv, contexts, polled, &timeout);