fwrite returns the number of items written, not the number of bytes.
authorpacman <pacman>
Sun, 7 Jan 2001 07:01:55 +0000 (07:01 +0000)
committerpacman <pacman>
Sun, 7 Jan 2001 07:01:55 +0000 (07:01 +0000)
fwrite(w,x,y,z) ~= write(fileno(z),w,x*y)/x

src/modules/rlm_unix/rlm_unix.c

index c7c1f9b..9dd91ed 100644 (file)
@@ -599,7 +599,7 @@ static int unix_accounting(void *instance, REQUEST *request)
         *      return RLM_MODULE_FAIL ..
         */
        if ((fp = fopen(inst->radwtmp, "a")) != NULL) {
-               if ((fwrite(&ut, sizeof(ut), 1, fp)) != sizeof(ut)) {
+               if ((fwrite(&ut, sizeof(ut), 1, fp)) != 1) {
                        fclose(fp);
                        return RLM_MODULE_FAIL;
                }