We'd segfault if we tried to get a non existant short keyid using keydb_fs;
fix this.
keydir(buffer, keyid);
d = opendir(buffer);
keydir(buffer, keyid);
d = opendir(buffer);
- do {
- de = readdir(d);
- if (de)
- if (de && de->d_name[0] != '.') {
- ret = strtoull(de->d_name, NULL, 16);
- }
- } while (de && de->d_name[0] == '.');
- closedir(d);
+ if (d) {
+ do {
+ de = readdir(d);
+ if (de)
+ if (de && de->d_name[0] != '.') {
+ ret = strtoull(de->d_name, NULL, 16);
+ }
+ } while (de && de->d_name[0] == '.');
+ closedir(d);
+ }