Skip to content

Commit 22a775f

Browse files
committed
Prefer recv and send over read and write when dealing with sockets
1 parent aba2725 commit 22a775f

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

backend/lpd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,7 +1057,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
10571057
}
10581058
else
10591059
{
1060-
if (read(fd, &status, 1) < 1)
1060+
if (recv(fd, &status, 1, 0) < 1)
10611061
{
10621062
_cupsLangPrintFilter(stderr, "WARNING",
10631063
_("The printer did not respond."));
@@ -1189,7 +1189,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
11891189
}
11901190
else
11911191
{
1192-
if (read(fd, &status, 1) < 1)
1192+
if (recv(fd, &status, 1, 0) < 1)
11931193
{
11941194
_cupsLangPrintFilter(stderr, "WARNING",
11951195
_("The printer did not respond."));

backend/socket.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
378378
tbytes = 0;
379379

380380
if (bytes > 0)
381-
tbytes += write(device_fd, buffer, (size_t)bytes);
381+
tbytes += send(device_fd, buffer, (size_t)bytes, 0);
382382

383383
while (copies > 0 && tbytes >= 0)
384384
{
@@ -472,7 +472,7 @@ wait_bc(int device_fd, /* I - Socket */
472472
* Grab the data coming back and spit it out to stderr...
473473
*/
474474

475-
if ((bytes = read(device_fd, buffer, sizeof(buffer))) > 0)
475+
if ((bytes = recv(device_fd, buffer, sizeof(buffer), 0)) > 0)
476476
{
477477
fprintf(stderr, "DEBUG: Received %d bytes of back-channel data\n",
478478
(int)bytes);

0 commit comments

Comments
 (0)