Hi Marcel, On Thu, May 16, 2013 at 10:07 AM, Marcel Holtmann <marcel@xxxxxxxxxxxx> wrote: >> f = fopen("/dev/urandom", "rb"); >> if (f != NULL) { >> - fread(&seed, sizeof(seed), 1, f); >> + nread = fread(&seed, sizeof(seed), 1, f); >> fclose(f); >> } >> >> + if (f == NULL || nread != 1) >> + seed = time(NULL); >> + >> srand(seed); > > lets redo this in actually readable code ;) > > Checking f twice is not acceptable. And I still wonder why fopen() is here preferred over open(). I just sent another version that uses open()/read() instead. Compilation tested only. Regards, -- Anderson Lizardo Instituto Nokia de Tecnologia - INdT Manaus - Brazil -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html