fifolog_create.c (818bc4157a6c19bf3a858a8322bbd37dbc19ceb1) | fifolog_create.c (60e600c8fcce4d38125ee56812bd5badcd115cd7) |
---|---|
1/*- 2 * Copyright (c) 2005-2008 Poul-Henning Kamp 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 83 unchanged lines hidden (view full) --- 92 size = st.st_size; 93 94 if (size == 0) 95 size = recsize * (off_t)(24*60*60); 96 97 if (S_ISREG(st.st_mode) && ftruncate(fd, size) < 0) 98 return ("Could not ftrunc"); 99 | 1/*- 2 * Copyright (c) 2005-2008 Poul-Henning Kamp 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 83 unchanged lines hidden (view full) --- 92 size = st.st_size; 93 94 if (size == 0) 95 size = recsize * (off_t)(24*60*60); 96 97 if (S_ISREG(st.st_mode) && ftruncate(fd, size) < 0) 98 return ("Could not ftrunc"); 99 |
100 buf = calloc(recsize, 1); | 100 buf = calloc(1, recsize); |
101 if (buf == NULL) 102 return ("Could not malloc"); 103 104 strcpy(buf, FIFOLOG_FMT_MAGIC); /*lint !e64 */ 105 be32enc(buf + FIFOLOG_OFF_BS, recsize); 106 if (recsize != pwrite(fd, buf, recsize, 0)) { 107 i = errno; 108 free(buf); --- 14 unchanged lines hidden --- | 101 if (buf == NULL) 102 return ("Could not malloc"); 103 104 strcpy(buf, FIFOLOG_FMT_MAGIC); /*lint !e64 */ 105 be32enc(buf + FIFOLOG_OFF_BS, recsize); 106 if (recsize != pwrite(fd, buf, recsize, 0)) { 107 i = errno; 108 free(buf); --- 14 unchanged lines hidden --- |