Skip to content

Commit 967e0bc

Browse files
committed
add distinct error message for fcntl failures
1 parent ed6eb27 commit 967e0bc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

file-locking/fcntl-locking.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,23 +106,23 @@ lock(int fd, struct flock *fl)
106106
{
107107
fl->l_type = F_WRLCK;
108108
if (fcntl(fd, F_SETLKW, fl) == -1)
109-
err(1, "fcntl");
109+
err(1, "fcntl lock W");
110110
}
111111

112112
static void
113113
lockr(int fd, struct flock *fl)
114114
{
115115
fl->l_type = F_RDLCK;
116116
if (fcntl(fd, F_SETLKW, fl) == -1)
117-
err(1, "fcntl");
117+
err(1, "fcntl lock R");
118118
}
119119

120120
static void
121121
unlock(int fd, struct flock *fl)
122122
{
123123
fl->l_type = F_UNLCK;
124124
if (fcntl(fd, F_SETLKW, fl) == -1)
125-
err(1, "fcntl");
125+
err(1, "fcntl unlock");
126126
}
127127

128128
/*

0 commit comments

Comments
 (0)