@@ -2075,7 +2075,7 @@ int flb_utils_get_machine_id(char **out_id, size_t *out_size)
20752075 size_t bytes ;
20762076 char * uuid ;
20772077 int fallback = FLB_FALSE ;
2078- char * fallback_id = "machine-id" ; //should reside in current working directory
2078+ char * fallback_id_file = "machine-id" ; //should reside in current working directory
20792079
20802080#ifdef __linux__
20812081 char * dbus_var = "/var/lib/dbus/machine-id" ;
@@ -2111,9 +2111,9 @@ int flb_utils_get_machine_id(char **out_id, size_t *out_size)
21112111 }
21122112 }
21132113
2114- if (access (fallback_id , F_OK ) == 0 )
2114+ if (access (fallback_id_file , F_OK ) == 0 )
21152115 {
2116- ret = machine_id_read_and_sanitize (fallback_id , & id , & bytes );
2116+ ret = machine_id_read_and_sanitize (fallback_id_file , & id , & bytes );
21172117 if (ret == 0 )
21182118 {
21192119 if (bytes == 0 ) {
@@ -2232,11 +2232,11 @@ int flb_utils_get_machine_id(char **out_id, size_t *out_size)
22322232
22332233 if (ret == 0 ) {
22342234
2235- int write_result = write_uuid_to_file (fallback_id , uuid );
2236- if (write_result != 0 )
2237- {
2238- //writing failed, next uuid generation
2239- flb_warn ("failed to write machine-id to file %s" , fallback_id );
2235+ ret = write_uuid_to_file (fallback_id_file , uuid );
2236+ if (ret != 0 ){
2237+ //writing failed, next uuid generation will be random again
2238+ //write a message and return
2239+ flb_warn ("failed to write machine-id to file %s" , fallback_id_file );
22402240 }
22412241 * out_id = uuid ;
22422242 * out_size = strlen (uuid );
0 commit comments