We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 532f852 commit e8641baCopy full SHA for e8641ba
mrbgems/picoruby-machine/mrbgem.rake
@@ -9,5 +9,3 @@ MRuby::Gem::Specification.new('picoruby-machine') do |spec|
9
cc.defines << "PICORB_PLATFORM_POSIX"
10
end
11
12
-
13
mrbgems/picoruby-machine/ports/posix/machine.c
@@ -34,12 +34,16 @@ Machine_get_unique_id(char *id_str)
34
{
35
FILE *fp = fopen("/etc/machine-id", "r");
36
if (fp) {
37
- fgets(id_str, 32, fp);
+ if (fgets(id_str, 32, fp) == NULL) {
38
+ perror("Failed to read /etc/machine-id");
39
+ fclose(fp);
40
+ return false;
41
+ }
42
fclose(fp);
- } else {
- perror("Failed to open /etc/machine-id");
43
+ return true;
44
}
- return true;
45
+ perror("Failed to open /etc/machine-id");
46
47
48
49
uint32_t
0 commit comments