[patch] ftpd: ptr == NULL

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[patch] ftpd: ptr == NULL

Fritjof Bornebusch
Hi,

cmd is a ptr.

--f.


Index: ftpd.c
===================================================================
RCS file: /cvs/src/libexec/ftpd/ftpd.c,v
retrieving revision 1.213
diff -u -r1.213 ftpd.c
--- ftpd.c 16 Mar 2016 15:41:10 -0000 1.213
+++ ftpd.c 5 Apr 2016 18:12:20 -0000
@@ -1151,7 +1151,7 @@
  pid_t pid;
  time_t start;
 
- if (cmd == 0) {
+ if (cmd == NULL) {
  fin = fopen(name, "r");
  st.st_size = 0;
  } else {
@@ -1166,14 +1166,14 @@
  if (fin == NULL) {
  if (errno != 0) {
  perror_reply(550, name);
- if (cmd == 0) {
+ if (cmd == NULL) {
  LOGCMD("get", name);
  }
  }
  return;
  }
  byte_count = -1;
- if (cmd == 0 && (fstat(fileno(fin), &st) < 0 || !S_ISREG(st.st_mode))) {
+ if (cmd == NULL && (fstat(fileno(fin), &st) < 0 || !S_ISREG(st.st_mode))) {
  reply(550, "%s: not a plain file.", name);
  goto done;
  }
@@ -1205,8 +1205,8 @@
  goto done;
  time(&start);
  send_data(fin, dout, (off_t)st.st_blksize, st.st_size,
-    (restart_point == 0 && cmd == 0 && S_ISREG(st.st_mode)));
- if ((cmd == 0) && stats)
+    (restart_point == 0 && cmd == NULL && S_ISREG(st.st_mode)));
+ if ((cmd == NULL) && stats)
  logxfer(name, byte_count, start);
  (void) fclose(dout);
  data = -1;
@@ -1214,7 +1214,7 @@
  if (pdata >= 0)
  (void) close(pdata);
  pdata = -1;
- if (cmd == 0) {
+ if (cmd == NULL) {
  LOGBYTES("get", name, byte_count);
  fclose(fin);
  } else {

Reply | Threaded
Open this post in threaded view
|

Re: [patch] ftpd: ptr == NULL

Héctor Luis Gimbatti
Seems ok

> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf
> Of [hidden email]
> Sent: Tuesday, April 05, 2016 15:22
> To: [hidden email]
> Subject: [patch] ftpd: ptr == NULL
>
> Hi,
>
> cmd is a ptr.
>
> --f.
>
>
> Index: ftpd.c
> =================================================================
> ==
> RCS file: /cvs/src/libexec/ftpd/ftpd.c,v retrieving revision 1.213
> diff -u -r1.213
> ftpd.c
> --- ftpd.c 16 Mar 2016 15:41:10 -0000 1.213
> +++ ftpd.c 5 Apr 2016 18:12:20 -0000
> @@ -1151,7 +1151,7 @@
>   pid_t pid;
>   time_t start;
>
> - if (cmd == 0) {
> + if (cmd == NULL) {
>   fin = fopen(name, "r");
>   st.st_size = 0;
>   } else {
> @@ -1166,14 +1166,14 @@
>   if (fin == NULL) {
>   if (errno != 0) {
>   perror_reply(550, name);
> - if (cmd == 0) {
> + if (cmd == NULL) {
>   LOGCMD("get", name);
>   }
>   }
>   return;
>   }
>   byte_count = -1;
> - if (cmd == 0 && (fstat(fileno(fin), &st) < 0 || !S_ISREG(st.st_mode))) {
> + if (cmd == NULL && (fstat(fileno(fin), &st) < 0 ||
> +!S_ISREG(st.st_mode))) {
>   reply(550, "%s: not a plain file.", name);
>   goto done;
>   }
> @@ -1205,8 +1205,8 @@
>   goto done;
>   time(&start);
>   send_data(fin, dout, (off_t)st.st_blksize, st.st_size,
> -    (restart_point == 0 && cmd == 0 && S_ISREG(st.st_mode)));
> - if ((cmd == 0) && stats)
> +    (restart_point == 0 && cmd == NULL && S_ISREG(st.st_mode)));
> + if ((cmd == NULL) && stats)
>   logxfer(name, byte_count, start);
>   (void) fclose(dout);
>   data = -1;
> @@ -1214,7 +1214,7 @@
>   if (pdata >= 0)
>   (void) close(pdata);
>   pdata = -1;
> - if (cmd == 0) {
> + if (cmd == NULL) {
>   LOGBYTES("get", name, byte_count);
>   fclose(fin);
>   } else {


smime.p7s (6K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [patch] ftpd: ptr == NULL

Sebastien Marie-2
In reply to this post by Fritjof Bornebusch
On Tue, Apr 05, 2016 at 08:22:22PM +0200, [hidden email] wrote:
> Hi,
>
> cmd is a ptr.
>
> --f.

I am OK with it (after a small change for fit 80 cols)

>
> Index: ftpd.c
> ===================================================================
> RCS file: /cvs/src/libexec/ftpd/ftpd.c,v
> retrieving revision 1.213
> diff -u -r1.213 ftpd.c
> --- ftpd.c 16 Mar 2016 15:41:10 -0000 1.213
> +++ ftpd.c 5 Apr 2016 18:12:20 -0000
> @@ -1151,7 +1151,7 @@
>   pid_t pid;
>   time_t start;
>  
> - if (cmd == 0) {
> + if (cmd == NULL) {
>   fin = fopen(name, "r");
>   st.st_size = 0;
>   } else {
> @@ -1166,14 +1166,14 @@
>   if (fin == NULL) {
>   if (errno != 0) {
>   perror_reply(550, name);
> - if (cmd == 0) {
> + if (cmd == NULL) {
>   LOGCMD("get", name);
>   }
>   }
>   return;
>   }
>   byte_count = -1;
> - if (cmd == 0 && (fstat(fileno(fin), &st) < 0 || !S_ISREG(st.st_mode))) {
> + if (cmd == NULL && (fstat(fileno(fin), &st) < 0 || !S_ISREG(st.st_mode))) {

 here -^

>   reply(550, "%s: not a plain file.", name);
>   goto done;
>   }
> @@ -1205,8 +1205,8 @@
>   goto done;
>   time(&start);
>   send_data(fin, dout, (off_t)st.st_blksize, st.st_size,
> -    (restart_point == 0 && cmd == 0 && S_ISREG(st.st_mode)));
> - if ((cmd == 0) && stats)
> +    (restart_point == 0 && cmd == NULL && S_ISREG(st.st_mode)));
> + if ((cmd == NULL) && stats)
>   logxfer(name, byte_count, start);
>   (void) fclose(dout);
>   data = -1;
> @@ -1214,7 +1214,7 @@
>   if (pdata >= 0)
>   (void) close(pdata);
>   pdata = -1;
> - if (cmd == 0) {
> + if (cmd == NULL) {
>   LOGBYTES("get", name, byte_count);
>   fclose(fin);
>   } else {
>
>

--
Sebastien Marie

Reply | Threaded
Open this post in threaded view
|

Re: [patch] ftpd: ptr == NULL

Sebastien Marie-2
On Wed, Apr 06, 2016 at 06:50:04AM +0200, Sebastien Marie wrote:
> On Tue, Apr 05, 2016 at 08:22:22PM +0200, [hidden email] wrote:
> > Hi,
> >
> > cmd is a ptr.
> >
> > --f.
>
> I am OK with it (after a small change for fit 80 cols)
>

Commited. Thanks !
--
Sebastien Marie