Skip to content

Commit 515fd83

Browse files
authored
Merge pull request #232 from michaelforney/misc-fixes
Minor portability fixes
2 parents 6955174 + 41bb2ba commit 515fd83

File tree

7 files changed

+10
-13
lines changed

7 files changed

+10
-13
lines changed

meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ project('casync', 'c',
44
version : '2',
55
license : 'LGPLv2+',
66
default_options: [
7-
'c_std=gnu99',
7+
'c_std=gnu11',
88
'prefix=/usr',
99
'sysconfdir=/etc',
1010
'localstatedir=/var',

src/canbd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
#include <fcntl.h>
44
#include <linux/fs.h>
55
#include <linux/nbd.h>
6+
#include <poll.h>
67
#include <stddef.h>
78
#include <sys/file.h>
89
#include <sys/ioctl.h>
9-
#include <sys/poll.h>
1010
#include <sys/prctl.h>
1111
#include <sys/socket.h>
1212
#include <sys/stat.h>

src/caremote.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
#include <errno.h>
44
#include <fcntl.h>
5+
#include <poll.h>
56
#include <stddef.h>
6-
#include <sys/poll.h>
77
#include <sys/prctl.h>
88
#include <sys/stat.h>
99

src/casync.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* SPDX-License-Identifier: LGPL-2.1+ */
22

33
#include <fcntl.h>
4-
#include <sys/poll.h>
4+
#include <poll.h>
55
#include <sys/stat.h>
66

77
#include "cacache.h"

src/util.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
#include <ctype.h>
44
#include <fcntl.h>
5+
#include <libgen.h>
6+
#include <poll.h>
57
#include <stdarg.h>
6-
#include <sys/poll.h>
78
#include <sys/stat.h>
89
#include <sys/wait.h>
910
#include <time.h>
@@ -15,12 +16,6 @@
1516
# include <sys/random.h>
1617
#endif
1718

18-
/* When we include libgen.h because we need dirname() we immediately
19-
* undefine basename() since libgen.h defines it as a macro to the
20-
* POSIX version which is really broken. We prefer GNU basename(). */
21-
#include <libgen.h>
22-
#undef basename
23-
2419
#include "def.h"
2520
#include "time-util.h"
2621
#include "util.h"
@@ -482,7 +477,8 @@ int tempfn_random(const char *p, char **ret) {
482477
* /foo/bar/.#waldobaa2a261115984a9
483478
*/
484479

485-
fn = basename(p);
480+
fn = strrchr(p, '/');
481+
fn = fn ? fn + 1 : p;
486482
if (!filename_is_valid(fn))
487483
return -EINVAL;
488484

test/notify-wait.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/* SPDX-License-Identifier: LGPL-2.1+ */
22

33
#include <fcntl.h>
4+
#include <poll.h>
45
#include <signal.h>
56
#include <stddef.h>
6-
#include <sys/poll.h>
77
#include <sys/socket.h>
88
#include <sys/un.h>
99
#include <sys/wait.h>

test/test-caencoder.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <stdio.h>
77
#include <stdlib.h>
88
#include <string.h>
9+
#include <sys/stat.h>
910
#include <unistd.h>
1011

1112
#include "cadecoder.h"

0 commit comments

Comments
 (0)