]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/ua_dotcmds.c
Commit backports from 2.3.x
[bacula/bacula] / bacula / src / dird / ua_dotcmds.c
index cbed06a1d090e79cd672cfe9f922e615999c7450..d8f4695074ca79564e45dbebd2452359264eb7be 100644 (file)
@@ -7,8 +7,8 @@
    many others, a complete list can be found in the file AUTHORS.
    This program is Free Software; you can redistribute it and/or
    modify it under the terms of version two of the GNU General Public
-   License as published by the Free Software Foundation plus additions
-   that are listed in the file LICENSE.
+   License as published by the Free Software Foundation and included
+   in the file LICENSE.
 
    This program is distributed in the hope that it will be useful, but
    WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -468,13 +468,17 @@ static int sql_handler(void *ctx, int num_field, char **row)
 
    for (int i=0; num_field--; i++) {
       if (i == 0) {
-         pm_strcpy(rows, row[0]);
+         pm_strcpy(rows, NPRT(row[0]));
       } else {
-         pm_strcat(rows, row[i]);
+         pm_strcat(rows, NPRT(row[i]));
       }
       pm_strcat(rows, "\t");
    }
-   ua->send_msg(rows.c_str());
+   if (!rows.c_str() || !*rows.c_str()) {
+      ua->send_msg("\t");
+   } else {
+      ua->send_msg("%s", rows.c_str());
+   }
    return 0;
 }