Changeset 597 for vendor/current/source3/printing/pcap.c
- Timestamp:
- Jul 2, 2011, 4:01:14 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/printing/pcap.c
r414 r597 126 126 } 127 127 128 void pcap_cache_reload(void )128 void pcap_cache_reload(void (*post_cache_fill_fn)(void)) 129 129 { 130 130 const char *pcap_name = lp_printcapname(); … … 133 133 XFILE *pcap_file; 134 134 char *pcap_line; 135 bool post_cache_fill_fn_handled = false; 135 136 136 137 DEBUG(3, ("reloading printcap cache\n")); … … 147 148 #ifdef HAVE_CUPS 148 149 if (strequal(pcap_name, "cups")) { 149 pcap_reloaded = cups_cache_reload(); 150 pcap_reloaded = cups_cache_reload(post_cache_fill_fn); 151 /* 152 * cups_cache_reload() is async and calls post_cache_fill_fn() 153 * on successful completion 154 */ 155 post_cache_fill_fn_handled = true; 150 156 goto done; 151 157 } … … 204 210 has_punctuation = (strchr_m(p, ' ') || 205 211 strchr_m(p, '\t') || 212 strchr_m(p, '"') || 213 strchr_m(p, '\'') || 214 strchr_m(p, ';') || 215 strchr_m(p, ',') || 206 216 strchr_m(p, '(') || 207 217 strchr_m(p, ')')); … … 212 222 } 213 223 214 if (strlen(p) <= MAXPRINTERLEN && 215 strlen(p) > strlen(name) && !has_punctuation) { 224 if (strlen(p) <= MAXPRINTERLEN && *name == '\0' && !has_punctuation) { 216 225 if (!*comment) { 217 226 strlcpy(comment, name, sizeof(comment)); … … 228 237 } 229 238 230 comment[60] = 0;231 name[MAXPRINTERLEN] = 0;232 233 239 if (*name && !pcap_cache_add(name, comment)) { 234 240 x_fclose(pcap_file); … … 243 249 DEBUG(3, ("reload status: %s\n", (pcap_reloaded) ? "ok" : "error")); 244 250 245 if (pcap_reloaded) 251 if (pcap_reloaded) { 246 252 pcap_cache_destroy_specific(&tmp_cache); 247 else { 253 if ((post_cache_fill_fn_handled == false) 254 && (post_cache_fill_fn != NULL)) { 255 post_cache_fill_fn(); 256 } 257 } else { 248 258 pcap_cache_destroy_specific(&pcap_cache); 249 259 pcap_cache = tmp_cache;
Note:
See TracChangeset
for help on using the changeset viewer.